Refactor platform initialization in GetConfigDirectory function

- Simplified platform variable initialization by removing redundant declarations and ensuring a default case for macOS.
- Improved code clarity and maintainability in the GetConfigDirectory function.
This commit is contained in:
scawful
2025-09-26 12:57:44 -04:00
parent 22c960eaf3
commit ffb88a2902

View File

@@ -80,18 +80,21 @@ void SaveFile(const std::string &filename, const std::string &contents) {
std::string GetConfigDirectory() { std::string GetConfigDirectory() {
std::string config_directory = ".yaze"; std::string config_directory = ".yaze";
Platform platform;
#if defined(__APPLE__) && defined(__MACH__) #if defined(__APPLE__) && defined(__MACH__)
#if TARGET_IPHONE_SIMULATOR == 1 || TARGET_OS_IPHONE == 1 #if TARGET_IPHONE_SIMULATOR == 1 || TARGET_OS_IPHONE == 1
Platform platform = Platform::kiOS; platform = Platform::kiOS;
#elif TARGET_OS_MAC == 1 #elif TARGET_OS_MAC == 1
Platform platform = Platform::kMacOS; platform = Platform::kMacOS;
#else
platform = Platform::kMacOS; // Default for macOS
#endif #endif
#elif defined(_WIN32) #elif defined(_WIN32)
Platform platform = Platform::kWindows; platform = Platform::kWindows;
#elif defined(__linux__) #elif defined(__linux__)
Platform platform = Platform::kLinux; platform = Platform::kLinux;
#else #else
Platform platform = Platform::kUnknown; platform = Platform::kUnknown;
#endif #endif
switch (platform) { switch (platform) {
case Platform::kWindows: case Platform::kWindows: