Browse Source

fix not creating test dir in some environment

Shelikhoo 4 years ago
parent
commit
3cd145a6f0
1 changed files with 2 additions and 1 deletions
  1. 2 1
      infra/conf/router_test.go

+ 2 - 1
infra/conf/router_test.go

@@ -28,9 +28,10 @@ func init() {
 
 
 	os.Setenv("v2ray.location.asset", tempPath)
 	os.Setenv("v2ray.location.asset", tempPath)
 
 
+	common.Must(os.MkdirAll(tempPath, 0755))
+
 	if _, err := os.Stat(platform.GetAssetLocation("geoip.dat")); err != nil && errors.Is(err, fs.ErrNotExist) {
 	if _, err := os.Stat(platform.GetAssetLocation("geoip.dat")); err != nil && errors.Is(err, fs.ErrNotExist) {
 		if _, err := os.Stat(geoipPath); err != nil && errors.Is(err, fs.ErrNotExist) {
 		if _, err := os.Stat(geoipPath); err != nil && errors.Is(err, fs.ErrNotExist) {
-			common.Must(os.MkdirAll(tempPath, 0755))
 			geoipBytes, err := common.FetchHTTPContent(geoipURL)
 			geoipBytes, err := common.FetchHTTPContent(geoipURL)
 			common.Must(err)
 			common.Must(err)
 			common.Must(filesystem.WriteFile(geoipPath, geoipBytes))
 			common.Must(filesystem.WriteFile(geoipPath, geoipBytes))