Announcement

Collapse
No announcement yet.

Access main.obb.png

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • replied
    No, you do not have permission to write to /system/etc. You should use GExternalFilePath from AndroidFile.cpp. FPaths::GamePersistentDownloadDir() will return this in 4.14.

    Leave a comment:


  • replied
    Originally posted by Chris Babcock View Post
    The binary only allows access to /system/etc/, the system font path, and external files directory.
    can i save a text file from my ue4 app in "/system/etc/" and then read from that folder?
    or there are some kind of permission issue ?

    and i am wondering why not give an option to toggle "AllowLocal" value from a BP node or just remove "AllowLocal" ??
    it is really frustrating that android user cannot access file in binary version of ue4.
    it turns out to be a big minus point for mobile Dev to use ue4 for android.

    Leave a comment:


  • replied
    The binary only allows access to /system/etc/, the system font path, and external files directory.

    Leave a comment:


  • replied
    Originally posted by Chris Babcock View Post
    .... It does not allow / unless the path is to certain directories.
    can u plz give paths of those specific directories?
    we need to read some text file from sdcard using binary version of ue4

    Leave a comment:


  • replied
    GExternalFilePath is one of the exceptions to requiring AllowLocal which is why it works.

    Leave a comment:


  • replied
    Hi Chris,
    Thanks for your anwser, and sorry for this long delay, I was busy
    However is not posible, I'm not able to touch any source code, I need solve my problem inside my plugin code. for now I'm using GExternalFilePath, when I use FFileHelper::SaveArrayToFile to save my files, for some reason just allow me copy inside GExternalFilePath, but fail for another locations, if I set AllowLocal to true, it will work I guess, but as I say before I can't edit source.

    Leave a comment:


  • replied
    Ok, I believe you hit the valid path check in PathToAndroidPaths in AndroidFile.cpp. It does not allow / unless the path is to certain directories. You can remove the check:

    if ((AllowLocal && AndroidPath.StartsWith(TEXT("/"))) ||

    just remove the AllowLocal.

    Leave a comment:


  • replied
    Actually yes! I have a little issue this time!
    I try to find a file inside my sdcard, but my functions always return false

    I use this two:
    Code:
    IFileManager* FileManager = &IFileManager::Get();
    FString path = GFilePathBase + TEXT("/test.txt");
    if (FileManager->FileExists(*path))
    {
    	AndroidThunkCpp_Log(LOG_TAG, GFilePathBase + "/test.txt");
    }
    if (FPaths::FileExists(path))
    {
    	AndroidThunkCpp_Log(LOG_TAG, "yes");
    }
    else
    {
    	AndroidThunkCpp_Log(LOG_TAG, "not");
    }
    my full path is: /storage/emulated/0/test.txt, I use java code again , File f = new File(path); returns true, so my file exist, I miss something I guess!

    best regards!

    Leave a comment:


  • replied
    Let me know if you need any more help .

    Leave a comment:


  • replied
    My god, I just waste my whole day, sorry I will never look for java code, here is the answer: https://forums.unrealengine.com/show...om-files-along

    My apologies

    Leave a comment:


  • started a topic Access main.obb.png

    Access main.obb.png

    Hi forum,
    I have no options anymore, so my question is for Mr. [MENTION=11153]Chris Babcock[/MENTION] , because I know he take care about android users, however I post here in case some guru are able to help me .
    This is the problem I have, I need access the main.obb.png because it have some files required for my app, this files are injected to the obb by using Additional Non-Assets Directores to copy in my project settings, and with an custom plugin, and with an custom APL.xml I´m able to introduce my own java code in unreal, now inside Java I use InputStream to access the zip file and get my files and work!!! YEEEEI, then inside my module I copy this file to another location and when my module start it´s work!!! YEEEI x2, but here the problem, because everything is package inside the .zip main.obb.png, depending of our project, sometimes this file is HUGEEEE!!!, and my InputStream is unable to read huge files, just fail, so right now I´m research for a new way to fix that, so you know a way to access it safety? or another way to inject my custom files inside my package?

    this the important code in java:
    Code:
    InputStream fin; = getAssets().open("main.obb.png"); // here the problem, this code work but just for small main.obb.png
    ZipInputStream zin = new ZipInputStream(fin);
    ZipEntry ze = null;
    while ((ze = zin.getNextEntry()) != null)
                {
                    if(ze.getName().contains("Content/MYFILES"))
                    {
                        String[] splitt = ze.getName().split("/");
                        String fileName = splitt[splitt.length - 1];
                        if(ze.isDirectory()) {
                            //dirChecker(ze.getName());
                        } else {
                            File checkPrev = new File(newPath + fileName);
                            if(checkPrev.exists())
                            {
                                android.util.Log.d("COPYLog", "unzipped before: "  + newPath + fileName);
                                zin.closeEntry();
                                continue;
                            }
    
                            FileOutputStream fout = new FileOutputStream(newPath + fileName);
                            for (int c = zin.read(); c != -1; c = zin.read()) {
                                fout.write(c);
                            }
    
                            android.util.Log.d("COPYLog", "unzipped: "  + newPath + fileName);
                            zin.closeEntry();
                            fout.close();
                        }
                    }
                }
                zin.close();
                android.util.Log.d("COPYLog", "unzipped complete! !");
Working...
X