gpt4 book ai didi

ios - 在 iOS 中使用 currentPath() 时的问题

转载 作者:行者123 更新时间:2023-11-28 19:54:56 25 4
gpt4 key购买 nike

在我的程序中,我使用类似于

的命令
QDir().mkdir(QDir::currentPath()+"/files");

if(QDir(QDir::currentPath()+"/profiles").exists())

如果我从内部运行它们似乎工作正常

test.app/Contents/MacOS/test

但如果我只是双击 test.app,它就会停止工作。

在我的例子中,它不会列出该目录中的文件

QDir path(QDir::currentPath()+"/profiles");
QStringList files = path.entryList(QDir::Files);

有什么办法可以解决这个问题吗?

最佳答案

您应该考虑使用 QStandardPaths : 当你必须处理路径时,这是一个非常有用的类。

QString exportedPlaylistLocation = QStandardPaths::writableLocation(QStandardPaths::MusicLocation);

但是,您仍然可以使用 QCoreApplication::applicationDirPath()QCoreApplication::applicationFilePath()

关于ios - 在 iOS 中使用 currentPath() 时的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27059425/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com