| 546 | #endif |
| 547 | |
| 548 | fextl::string GetDataDirectory(bool Global, const PortableInformation& PortableInfo) { |
| 549 | const char* DataOverride = getenv("FEX_APP_DATA_LOCATION"); |
| 550 | |
| 551 | if (PortableInfo.IsPortable && (Global || !DataOverride)) { |
| 552 | return fextl::fmt::format("{}/fex-emu/", PortableInfo.InterpreterPath); |
| 553 | } |
| 554 | |
| 555 | fextl::string DataDir {}; |
| 556 | if (Global) { |
| 557 | DataDir = GLOBAL_DATA_DIRECTORY; |
| 558 | } else { |
| 559 | const char* HomeDir = GetHomeDirectory(); |
| 560 | const char* DataXDG = getenv("XDG_DATA_HOME"); |
| 561 | if (DataOverride) { |
| 562 | // Data override will override the complete directory |
| 563 | DataDir = DataOverride; |
| 564 | } else { |
| 565 | DataDir = DataXDG ?: HomeDir; |
| 566 | DataDir += "/.fex-emu/"; |
| 567 | } |
| 568 | } |
| 569 | return DataDir; |
| 570 | } |
| 571 | |
| 572 | fextl::string GetConfigDirectory(bool Global, const PortableInformation& PortableInfo) { |
| 573 | const char* ConfigOverride = getenv("FEX_APP_CONFIG_LOCATION"); |
no test coverage detected