ue4 ios

project settings package 可以指定非APK打包,确定资源是否发布

可以指定content下某个目录所有文件(非.uassert)都打包

 

ios环境下fopen打开文件需要指定路径

这么转换一下就可以了

    FString ConvertToIOSPath(const FString& Filename, bool bForWrite)
    {
        FString Result = Filename;
#ifdef __OBJC__
        if (Result.Contains(TEXT("/OnDemandResources/")))
        {
            return Result;
        }

        Result.ReplaceInline(TEXT("../"), TEXT(""));
        Result.ReplaceInline(TEXT(".."), TEXT(""));
        Result.ReplaceInline(FPlatformProcess::BaseDir(), TEXT(""));

        if (bForWrite)
        {
            static FString WritePathBase = FString([NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0]) + TEXT("/");
            return WritePathBase + Result;
        }
        else
        {
            // if filehostip exists in the command line, cook on the fly read path should be used
            FString Value;
            // Cache this value as the command line doesn't change...
            static bool bHasHostIP = FParse::Value(FCommandLine::Get(), TEXT("filehostip"), Value) || FParse::Value(FCommandLine::Get(), TEXT("streaminghostip"), Value);
            static bool bIsIterative = FParse::Value(FCommandLine::Get(), TEXT("iterative"), Value);
            if (bHasHostIP)
            {
                static FString ReadPathBase = FString([NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0]) + TEXT("/");
                return ReadPathBase + Result;
            }
            else if (bIsIterative)
            {
                static FString ReadPathBase = FString([NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0]) + TEXT("/");
                return ReadPathBase + Result.ToLower();
            }
            else
            {
                static FString ReadPathBase = FString([[NSBundle mainBundle] bundlePath]) + TEXT("/cookeddata/");
                return ReadPathBase + Result.ToLower();
            }
        }
#endif
        return Result;
    }

 

转载于:https://www.cnblogs.com/wanliyun/p/6258054.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值