50#if LASS_PLATFORM_TYPE == LASS_PLATFORM_TYPE_WIN32
51# pragma warning(disable: 4996)
78#if LASS_HAVE_WCHAR_SUPPORT && LASS_HAVE_WFOPEN
81 FILE* file = fopen(fileName.c_str(),
"r");
92#if LASS_HAVE_WCHAR_SUPPORT
100 FILE* file = _wfopen(fileName.c_str(), L
"r");
123 std::string::size_type lastDot = fileName.rfind(extensionSeperator);
124 return lastDot!= std::string::npos ? fileName.substr(lastDot + 1) :
"";
128#if LASS_HAVE_WCHAR_SUPPORT
138 std::wstring::size_type lastDot = fileName.rfind(wextensionSeperator);
139 return lastDot!= std::wstring::npos ? fileName.substr(lastDot + 1) : L
"";
153 return fileName.substr(0, fileName.rfind(extensionSeperator));
157#if LASS_HAVE_WCHAR_SUPPORT
167 return fileName.substr(0, fileName.rfind(wextensionSeperator));
181 const char seperators[] = { pathSeperator, pathAlternativeSeperator,
'\0' };
182 std::string::size_type lastSlash = fileName.find_last_of(seperators);
183 return lastSlash != std::string::npos ? fileName.substr(0, lastSlash) :
"";
187#if LASS_HAVE_WCHAR_SUPPORT
195std::wstring
filePath(
const std::wstring& fileName)
197 const wchar_t seperators[] = { wpathSeperator, wpathAlternativeSeperator, L
'\0' };
198 std::wstring::size_type lastSlash = fileName.find_last_of(seperators);
199 return lastSlash != std::wstring::npos ? fileName.substr(0, lastSlash) : L
"";
213 const char seperators[] = { pathSeperator, pathAlternativeSeperator,
'\0' };
214 std::string::size_type lastSlash = fileName.find_last_of(seperators);
215 return lastSlash != std::string::npos ? fileName.substr(lastSlash + 1) : fileName;
219#if LASS_HAVE_WCHAR_SUPPORT
229 const wchar_t seperators[] = { wpathSeperator, wpathAlternativeSeperator, L
'\0' };
230 std::wstring::size_type lastSlash = fileName.find_last_of(seperators);
231 return lastSlash != std::wstring::npos ? fileName.substr(lastSlash + 1) : fileName;
239std::string fileJoinExtension(
const std::string& fileName,
const std::string& extension)
243 return fileName + extension;
245 return fileName + extensionSeperator + extension;
249#if LASS_HAVE_WCHAR_SUPPORT
253std::wstring fileJoinExtension(
const std::wstring& fileName,
const std::wstring& extension)
257 return fileName + extension;
259 return fileName + wextensionSeperator + extension;
267std::string fileJoinPath(
const std::string& path,
const std::string& fileName)
271 return path + fileName;
273 if (pathAlternativeSeperator &&
stde::ends_with(path, pathAlternativeSeperator))
275 return path + fileName;
277 return path + pathSeperator + fileName;
281#if LASS_HAVE_WCHAR_SUPPORT
285std::wstring fileJoinPath(
const std::wstring& path,
const std::wstring& fileName)
289 return path + fileName;
291 if (wpathAlternativeSeperator &&
stde::ends_with(path, wpathAlternativeSeperator))
293 return path + fileName;
295 return path + wpathSeperator + fileName;
bool fileDoesExist(const std::string &fileName)
return true if file exists
std::string fileWithoutPath(const std::string &fileName)
return the part of the file name behind the last (back)slash.
std::string filePath(const std::string &fileName)
return the part of the file name before the last (back)slash.
std::string fileExtension(const std::string &fileName)
return the part of the file name behind the last dot.
std::string fileWithoutExtension(const std::string &fileName)
return the part of the file name before the last dot.
bool begins_with(const std::basic_string< Char, Traits, Alloc > &input, const std::basic_string< Char, Traits, Alloc > &prefix)
returns true if input begins with the input prefix
bool ends_with(const std::basic_string< Char, Traits, Alloc > &input, const std::basic_string< Char, Traits, Alloc > &suffix)
returns true if input ends with the input suffix
streams, binary streams, vrmlstreams, ...
Library for Assembled Shared Sources.