| 1 | #include "Library/Debug/Host.h" |
| 2 | |
| 3 | #include <devenv/seadEnvUtil.h> |
| 4 | #include <nn/os.h> |
| 5 | |
| 6 | namespace al { |
| 7 | void getComputerName(sead::BufferedSafeString* computerName) { |
| 8 | tryGetComputerName(computerName); |
| 9 | } |
| 10 | |
| 11 | bool tryGetComputerName(sead::BufferedSafeString* computerName) { |
| 12 | computerName->format(formatStr: "" ); |
| 13 | computerName->format(formatStr: "" ); |
| 14 | |
| 15 | return sead::EnvUtil::getEnvironmentVariable(out: computerName, variable: "COMPUTERNAME" ) > 0; |
| 16 | } |
| 17 | |
| 18 | void getUserName(sead::BufferedSafeString* userName) { |
| 19 | userName->format(formatStr: "" ); |
| 20 | userName->format(formatStr: "" ); |
| 21 | |
| 22 | sead::EnvUtil::getEnvironmentVariable(out: userName, variable: "USERNAME" ); |
| 23 | } |
| 24 | |
| 25 | void makeUniqueTemporaryFilename(sead::BufferedSafeString* out, const char* fileName) { |
| 26 | sead::FixedSafeString<128> computerName; |
| 27 | getComputerName(computerName: &computerName); |
| 28 | |
| 29 | nn::os::Tick time = nn::os::GetSystemTick(); |
| 30 | out->format(formatStr: "%s_%012lld%s" , computerName.cstr(), time, fileName); |
| 31 | } |
| 32 | |
| 33 | void expandEnvironmentString(sead::BufferedSafeString* out, const sead::SafeString& envStr) { |
| 34 | out->clear(); |
| 35 | |
| 36 | FUN_710086f65c(out, envStr); |
| 37 | } |
| 38 | |
| 39 | // void FUN_710086f65c(sead::BufferedSafeString* out, const sead::SafeString& envStr) {} |
| 40 | |
| 41 | sead::FixedSafeString<128> makeTmpExpandEnvironmentString(const sead::SafeString& envStr) { |
| 42 | sead::FixedSafeString<128> tmp; |
| 43 | |
| 44 | expandEnvironmentString(out: &tmp, envStr); |
| 45 | |
| 46 | return tmp; |
| 47 | } |
| 48 | |
| 49 | StringTmp<128> makeTmpFileFullPath(const char* fileName) { |
| 50 | return StringTmp<128>("${TEMP}/%012lld%s" , nn::os::GetSystemTick(), |
| 51 | fileName != nullptr ? fileName : "" ); |
| 52 | } |
| 53 | |
| 54 | const char* getALCommon() { |
| 55 | return "${AL_TOOL_ROOT}/ALCommon" ; |
| 56 | } |
| 57 | } // namespace al |
| 58 | |