mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-12-22 01:57:12 -05:00
Allow setting permission on CopyFile helper
This commit is contained in:
parent
887280e848
commit
353326b432
@ -45,12 +45,12 @@ func ReadAsset(file string) ([]byte, error) {
|
||||
return ReadFile(platform.GetAssetLocation(file))
|
||||
}
|
||||
|
||||
func CopyFile(dst string, src string) error {
|
||||
func CopyFile(dst string, src string, perm os.FileMode) error {
|
||||
bytes, err := ReadFile(src)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
f, err := os.OpenFile(dst, os.O_CREATE|os.O_WRONLY, 0o644)
|
||||
f, err := os.OpenFile(dst, os.O_CREATE|os.O_WRONLY, perm)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ func init() {
|
||||
func TestToCidrList(t *testing.T) {
|
||||
t.Log(os.Getenv("v2ray.location.asset"))
|
||||
|
||||
common.Must(filesystem.CopyFile(platform.GetAssetLocation("geoiptestrouter.dat"), platform.GetAssetLocation("geoip.dat")))
|
||||
common.Must(filesystem.CopyFile(platform.GetAssetLocation("geoiptestrouter.dat"), platform.GetAssetLocation("geoip.dat"), 0o600))
|
||||
|
||||
ips := cfgcommon.StringList([]string{
|
||||
"geoip:us",
|
||||
|
Loading…
Reference in New Issue
Block a user