UE4中 路径引用 书写问题

目的: 项目打包之后, 一般需要通过外部的配置文件来更改项目中的某些变量, 这时候 配置文件的 设置路径就有了重要的意义。
本文从 ini 格式的文件进行入手,进行实际的测试效果。

测试前提: UE4 4.18 配置文件命名: test.ini
配置文件内容:
[IpSetting]
IpAdress=192.168.0.53
IpPort=8090

一,打包之后的路径定义

1,InstallDir/WindowsNoEditor/

含义: 直接在打包之后 WindowsNoEditor 目录之下
在这里插入图片描述
FString ThePath = FPaths::ConvertRelativePathToFull(FPaths::RootDir()) + TEXT(“test.ini”);;

2,InstallDir/WindowsNoEditor/GameName
在这里插入图片描述
FString ThePath = FPaths::ConvertRelativePathToFull(FPaths::GameDir()) + TEXT(“test.ini”);;

下面的未测试,以上两个对我来说已经足够使用了。
3, InstallDir/WindowsNoEditor/GameName/Content

//InstallDir/WindowsNoEditor/GameName/Content
FString ThePath = FPaths::ConvertRelativePathToFull(FPaths::GameContentDir());

4,InstallDir/WindowsNoEditor/GameName/Saved

//InstallDir/WindowsNoEditor/GameName/Saved
FString ThePath = FPaths::ConvertRelativePathToFull(FPaths::GameSavedDir());

5,InstallDir/WindowsNoEditor/GameName/Saved/Logs

//InstallDir/WindowsNoEditor/GameName/Saved/Logs
FString ThePath = FPaths::ConvertRelativePathToFull(FPaths::GameLogDir());

6,InstallDir/WindowsNoEditor/GameName/Plugins(新增)

FString ThePath = FPaths::ConvertRelativePathToFull(FPaths::ProjectPluginsDir());

二,未打包时的路径

FString ContentPath = FPaths::ConvertRelativePathToFull(FPaths::GameContentDir()) + TEXT(“Configs/test.ini”); //content 目录下的文件夹目录

比较邪门的是,使用未打包的路径,每次修改完之后,直接在editor 模式下运行, 修改的数据并不能直接反应在程序里面。还需要重新generate 一下才行, 为此就不再对此进行多余的操作了。

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值