Procházet zdrojové kódy

Merge pull request #303 from AtomicGameEngine/JME-ATOMIC-FIXANDROID

Don't use asset directory indicator by default
JoshEngebretson před 10 roky
rodič
revize
613fcb9dc2
2 změnil soubory, kde provedl 16 přidání a 12 odebrání
  1. 13 11
      Source/Atomic/IO/File.h
  2. 3 1
      Source/Atomic/IO/FileSystem.cpp

+ 13 - 11
Source/Atomic/IO/File.h

@@ -34,17 +34,19 @@
 namespace Atomic
 {
 
-#ifdef ANDROID
-extern const char* APK;
-
-#define ASSET_DIR_INDICATOR "_"
-
-// Macro for checking if a given pathname is inside APK's assets directory
-#define IS_ASSET(p) p.StartsWith(APK)
-// Macro for truncating the APK prefix string from the asset pathname and at the same time patching the directory name components (see custom_rules.xml)
-#define ASSET(p) p.Substring(5).Replaced("/", ASSET_DIR_INDICATOR "/").CString()
-#endif
-
+  #ifdef ANDROID
+  extern const char* APK;
+
+  // Macro for checking if a given pathname is inside APK's assets directory
+  #define IS_ASSET(p) p.StartsWith(APK)
+  // Macro for truncating the APK prefix string from the asset pathname and at the same time patching the directory name components (see custom_rules.xml)
+  #ifdef ASSET_DIR_INDICATOR
+  #define ASSET(p) p.Substring(5).Replaced("/", ASSET_DIR_INDICATOR "/").CString()
+  #else
+  #define ASSET(p) p.Substring(5).CString()
+  #endif
+  #endif
+  
 /// File open mode.
 enum FileMode
 {

+ 3 - 1
Source/Atomic/IO/FileSystem.cpp

@@ -795,6 +795,7 @@ void FileSystem::ScanDirInternal(Vector<String>& result, String path, const Stri
             if (!(flags & SCAN_HIDDEN) && fileName.StartsWith("."))
                 continue;
 
+#ifdef ASSET_DIR_INDICATOR
             // Patch the directory name back after retrieving the directory flag
             bool isDirectory = fileName.EndsWith(ASSET_DIR_INDICATOR);
             if (isDirectory)
@@ -806,7 +807,8 @@ void FileSystem::ScanDirInternal(Vector<String>& result, String path, const Stri
                     ScanDirInternal(result, path + fileName, startPath, filter, flags, recursive);
             }
             else if (flags & SCAN_FILES)
-            {
+#endif
+            {              
                 if (filterExtension.Empty() || fileName.EndsWith(filterExtension))
                     result.Push(deltaPath + fileName);
             }