2014-12-22 64 views
1

如果我嘗試將文件部署到部署資產\內部\ assets.zipassets.zip這樣的: enter image description here德爾福部署和Android的文件存儲

我已經試過各種路徑看看我能否找到資產文件夾或我的zip文件。所有的下面的代碼在這樣

S1 := TPath.GetHomePath + PathDelim; 
    S2 := FAppDataDirPathRoot + Application.Title + '.app' + PathDelim; 
    S3 := TPath.GetLibraryPath + PathDelim; 
    S4 := TPath.GetDocumentsPath + PathDelim; 

    if (DirectoryExists(S1)) then // '/data/data/com.embarcadero.xxx/files/': yes: 
    msAppNoOp 
    ; 
    if (DirectoryExists(S2)) then // ...: no, leftover test from iOS 
    msAppNoOp 
    ; 
    if (DirectoryExists(S3)) then // '/data/app-lib/com.embarcadero.xxx-2/': yes 
    msAppNoOp 
    ; 
    if (DirectoryExists(S4)) then // '/data/data/com.embarcadero.xxx/files/' yes 
    msAppNoOp 
    ; 

    if (DirectoryExists(S1 + 'assets' + PathDelim)) then // no 
    msAppNoOp 
    ; 
    if (DirectoryExists(S2 + 'assets' + PathDelim)) then // no 
    msAppNoOp 
    ; 
    if (DirectoryExists(S3 + 'assets' + PathDelim)) then // no 
    msAppNoOp 
    ; 
    if (DirectoryExists(S4 + 'assets' + PathDelim)) then // no 
    msAppNoOp 
    ; 

    S1 := S1 + 'assets.zip'; 
    S2 := S2 + 'assets.zip'; 
    S3 := S3 + 'assets.zip'; 
    S4 := S4 + 'assets.zip'; 


    if (FileExists(S1)) then // no 
    msAppNoOp 
    ; 
    if (FileExists(S2)) then // no 
    msAppNoOp 
    ; 
    if (FileExists(S3)) then // no 
    msAppNoOp 
    ; 
    if (FileExists(S4)) then // no 
    msAppNoOp 
    ; 

不成功當瀏覽我的手機在Windows資源管理器看不到數據/數據/ ...我相信這是唯一可能根植手機...

回答

3

根據documentation,如果您部署到assets/internal,則需要使用TPath.GetDocumentsPath在運行時獲取部署文件所在的文件夾。嘗試使用TPath.Combine()而不是直接使用PathDelim

S4 := TPath.Combine(TPath.GetDocumentsPath, 'assets.zip'); 
if (FileExists(S4)) then 
+0

感謝 - 它似乎現在工作。不太確定我如何創建一系列不會導致解決方案的測試:) – Tom