Changeset View
Changeset View
Standalone View
Standalone View
source/lib/os_path.h
/* Copyright (C) 2010 Wildfire Games. | /* Copyright (C) 2021 Wildfire Games. | ||||
* | * | ||||
* Permission is hereby granted, free of charge, to any person obtaining | * Permission is hereby granted, free of charge, to any person obtaining | ||||
* a copy of this software and associated documentation files (the | * a copy of this software and associated documentation files (the | ||||
* "Software"), to deal in the Software without restriction, including | * "Software"), to deal in the Software without restriction, including | ||||
* without limitation the rights to use, copy, modify, merge, publish, | * without limitation the rights to use, copy, modify, merge, publish, | ||||
* distribute, sublicense, and/or sell copies of the Software, and to | * distribute, sublicense, and/or sell copies of the Software, and to | ||||
* permit persons to whom the Software is furnished to do so, subject to | * permit persons to whom the Software is furnished to do so, subject to | ||||
* the following conditions: | * the following conditions: | ||||
Show All 26 Lines | |||||
{ | { | ||||
return path.string(); | return path.string(); | ||||
} | } | ||||
#else | #else | ||||
static inline std::string OsString(const OsPath& path) | static inline std::string OsString(const OsPath& path) | ||||
{ | { | ||||
const Path::String& wstring = path.string(); | return utf8_from_wstring(path.string()); | ||||
std::string string(wstring.length(), '\0'); | |||||
for(size_t i = 0; i < wstring.length(); i++) | |||||
{ | |||||
ENSURE((unsigned)wstring[i] <= (unsigned)UCHAR_MAX); | |||||
string[i] = (char)wstring[i]; | |||||
} | |||||
return string; | |||||
} | } | ||||
#endif | #endif | ||||
#endif // #ifndef INCLUDED_OS_PATH | #endif // #ifndef INCLUDED_OS_PATH |
Wildfire Games · Phabricator