| 34 | } |
| 35 | |
| 36 | std::optional<std::string> JoinPath( const char* path1, const char* path2 ) |
| 37 | { |
| 38 | #if _WIN32 |
| 39 | char p1[MAX_PATH]; |
| 40 | strcpy_s( p1, path1 ); |
| 41 | if( !PathAppend( p1, path2 ) ) |
| 42 | { |
| 43 | return std::nullopt; |
| 44 | } |
| 45 | for( auto p = p1; *p; ++p ) |
| 46 | { |
| 47 | if( *p == '/' ) |
| 48 | { |
| 49 | *p = '\\'; |
| 50 | } |
| 51 | } |
| 52 | char fullPath[MAX_PATH]; |
| 53 | if( !PathCanonicalize( fullPath, p1 ) ) |
| 54 | { |
| 55 | return std::nullopt; |
| 56 | } |
| 57 | return fullPath; |
| 58 | #else |
| 59 | // TODO MACOS |
| 60 | return std::string( path1 ) + "/" + path2; |
| 61 | #endif |
| 62 | } |
| 63 | |
| 64 | } |
| 65 |