----------------------------------------------------
| 274 | } |
| 275 | //---------------------------------------------------- |
| 276 | void LuaControlDialog_t::openLuaScriptFile(void) |
| 277 | { |
| 278 | #ifdef _S9XLUA_H |
| 279 | int ret, useNativeFileDialogVal; |
| 280 | QString filename; |
| 281 | std::string last; |
| 282 | std::string dir; |
| 283 | const char *exePath = nullptr; |
| 284 | const char *luaPath = nullptr; |
| 285 | QFileDialog dialog(this, tr("Open LUA Script")); |
| 286 | QList<QUrl> urls; |
| 287 | QDir d; |
| 288 | |
| 289 | exePath = fceuExecutablePath(); |
| 290 | |
| 291 | //urls = dialog.sidebarUrls(); |
| 292 | urls << QUrl::fromLocalFile(QDir::rootPath()); |
| 293 | urls << QUrl::fromLocalFile(QStandardPaths::standardLocations(QStandardPaths::HomeLocation).first()); |
| 294 | urls << QUrl::fromLocalFile(QStandardPaths::standardLocations(QStandardPaths::DesktopLocation).first()); |
| 295 | urls << QUrl::fromLocalFile(QStandardPaths::standardLocations(QStandardPaths::DownloadLocation).first()); |
| 296 | urls << QUrl::fromLocalFile(QDir(FCEUI_GetBaseDirectory()).absolutePath()); |
| 297 | |
| 298 | if (exePath[0] != 0) |
| 299 | { |
| 300 | d.setPath(QString(exePath) + "/../luaScripts"); |
| 301 | |
| 302 | if (d.exists()) |
| 303 | { |
| 304 | urls << QUrl::fromLocalFile(d.absolutePath()); |
| 305 | } |
| 306 | } |
| 307 | #ifndef WIN32 |
| 308 | d.setPath("/usr/share/fceux/luaScripts"); |
| 309 | |
| 310 | if (d.exists()) |
| 311 | { |
| 312 | urls << QUrl::fromLocalFile(d.absolutePath()); |
| 313 | } |
| 314 | #endif |
| 315 | |
| 316 | luaPath = getenv("LUA_PATH"); |
| 317 | |
| 318 | // Parse LUA_PATH and add to urls |
| 319 | if (luaPath) |
| 320 | { |
| 321 | int i, j; |
| 322 | char stmp[2048]; |
| 323 | |
| 324 | i = j = 0; |
| 325 | while (luaPath[i] != 0) |
| 326 | { |
| 327 | if (luaPath[i] == ';') |
| 328 | { |
| 329 | stmp[j] = 0; |
| 330 | |
| 331 | if (j > 0) |
| 332 | { |
| 333 | d.setPath(stmp); |
nothing calls this directly
no test coverage detected