소스 검색

Simplify the resource prefix path engine parameter handling.
Also ensure that relative prefix path is being resolved relative to the program dir regardless of where the prefix path parameter value is coming from.

Yao Wei Tjong 姚伟忠 11 년 전
부모
커밋
2906365c97
1개의 변경된 파일5개의 추가작업 그리고 6개의 파일을 삭제
  1. 5 6
      Source/Urho3D/Engine/Engine.cpp

+ 5 - 6
Source/Urho3D/Engine/Engine.cpp

@@ -199,12 +199,11 @@ bool Engine::Initialize(const VariantMap& parameters)
     ResourceCache* cache = GetSubsystem<ResourceCache>();
     ResourceCache* cache = GetSubsystem<ResourceCache>();
     FileSystem* fileSystem = GetSubsystem<FileSystem>();
     FileSystem* fileSystem = GetSubsystem<FileSystem>();
 
 
-    String defaultPrefixPath(AddTrailingSlash(getenv("URHO3D_PREFIX_PATH")));
-    if (defaultPrefixPath.Empty())
-        defaultPrefixPath = fileSystem->GetProgramDir();
-    else if (!IsAbsolutePath(defaultPrefixPath))
-        defaultPrefixPath = fileSystem->GetProgramDir() + defaultPrefixPath;
-    String resourcePrefixPath = AddTrailingSlash(GetParameter(parameters, "ResourcePrefixPath", defaultPrefixPath).GetString());
+    String resourcePrefixPath = AddTrailingSlash(GetParameter(parameters, "ResourcePrefixPath", getenv("URHO3D_PREFIX_PATH")).GetString());
+    if (resourcePrefixPath.Empty())
+        resourcePrefixPath = fileSystem->GetProgramDir();
+    else if (!IsAbsolutePath(resourcePrefixPath))
+        resourcePrefixPath = fileSystem->GetProgramDir() + resourcePrefixPath;
     Vector<String> resourcePaths = GetParameter(parameters, "ResourcePaths", "Data;CoreData").GetString().Split(';');
     Vector<String> resourcePaths = GetParameter(parameters, "ResourcePaths", "Data;CoreData").GetString().Split(';');
     Vector<String> resourcePackages = GetParameter(parameters, "ResourcePackages").GetString().Split(';');
     Vector<String> resourcePackages = GetParameter(parameters, "ResourcePackages").GetString().Split(';');
     Vector<String> autoLoadPaths = GetParameter(parameters, "AutoloadPaths", "Autoload").GetString().Split(';');
     Vector<String> autoLoadPaths = GetParameter(parameters, "AutoloadPaths", "Autoload").GetString().Split(';');