目录路径错误,我做错了吗

发布于 11-15 11:19 字数 566 浏览 2 评论 0原文

我有我的 .exe 和三个文件夹。每个文件夹中都有一个 .txt 文件,我的程序会读取该文件以及要加载的一些图像。当一切都在 .exe 中时,这一切都工作正常,但现在它在文件夹中已停止工作。

我认为问题是在文件夹 A 中有 A.txt 加载 A.png 正在工作,但 A.txt 也从文件夹 B 加载 B.png。我已将 B/B.png 放入 A.txt 但我认为这可能就是问题所在。

问题是我想上一层然后再回到另一个文件夹吗?

并且是我可以放入像 upfolder/B/B.png 这样的路径名中的命令,或者是将文件夹 B 放入文件夹 A 中的唯一选项,但我不想这样做。

或者,如果有更好的方法或按类型组织资源,我愿意改变。

编辑:您要求代码,但这都与程序之外的内容有关。但我会给你一个我正在采取的路径的例子。

user/documents/map/map.txt

在该map.txt中有一行 monster/yeti.txt 该文件的完整路径是 user/documents/monster/yeti.txt

我怎样才能将map.txt中的路径写入从地图文件夹中出来并进入怪物文件夹?

I have my .exe and three folders with it. in each folder is a .txt file that my program reads and some images to load. This was all working fine when everything was with the .exe but has stopped working now it is in folders.

I think the problem is that in folder A there is A.txt that loads A.png which is working but A.txt also loads B.png from folder B. I have put B/B.png in A.txt but I think this may be the problem.

Is the problem that I want to go up a level and then back down into another folder?

and is the a command that I can put in the pathname like upfolder/B/B.png or is the only option to put folder B in Folder A which I do not want to do.

Or if there is a better way or organising the resources by type I am open to changing.

EDIT: you ask for code but this all concerns the stuff outside the program. but il give u an example of paths I am taking about.

user/documents/map/map.txt

in that map .txt there is the line monster/yeti.txt the full path to that file is user/documents/monster/yeti.txt

How can I write the path in map.txt to come out of the map folder and into the monster folder?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

帅的被狗咬2024-11-22 11:19:59

我不是 100% 确定,因为我现在无法亲自尝试,但请尝试 ./ (来自 .exe 根目录)或 ../ (上一级)。

I'm not 100% sure as I cannot try it out myself at the minute, but try ./ (from .exe root) or ../ (up one level).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文