@@ -52,25 +52,22 @@ namespace SlangRecord
52
52
// know something wrong with the loadFile call if we can't find the file in the record directory.
53
53
if ((res == SLANG_OK) && (*outBlob != nullptr ) && ((*outBlob)->getBufferSize () != 0 ))
54
54
{
55
- std::filesystem::path filePath = m_recordManager->getRecordFileDirectory ();
56
- filePath = filePath / path;
57
-
58
- if (!File::exists (filePath.parent_path ().string ().c_str ()))
55
+ Slang::String filePath = Slang::Path::combine (m_recordManager->getRecordFileDirectory (), path);
56
+ Slang::String dirPath = Slang::Path::getParentDirectory (filePath);
57
+ if (!File::exists (dirPath))
59
58
{
60
59
slangRecordLog (LogLevel::Debug, " Create directory: %s to save captured shader file: %s\n " ,
61
- filePath. parent_path (). string (). c_str () , filePath.filename (). string (). c_str ());
60
+ dirPath. getBuffer () , filePath.getBuffer ());
62
61
63
- std::error_code ec;
64
- // std::filesystem::create_directories can create the directory recursively.
65
- if (!std::filesystem::create_directories (filePath.parent_path (), ec))
62
+ if (!Path::createDirectoryRecursive (dirPath))
66
63
{
67
- slangRecordLog (LogLevel::Error, " Fail to create directory: %s, error (%d): %s \n " ,
68
- filePath. parent_path (). string (). c_str (), ec. value (), ec. message (). c_str ());
64
+ slangRecordLog (LogLevel::Error, " Fail to create directory: %s\n " ,
65
+ dirPath. getBuffer ());
69
66
return SLANG_FAIL;
70
67
}
71
68
}
72
69
73
- FileOutputStream fileStream (filePath. string (). c_str () );
70
+ FileOutputStream fileStream (filePath);
74
71
75
72
fileStream.write ((*outBlob)->getBufferPointer (), (*outBlob)->getBufferSize ());
76
73
fileStream.flush ();
0 commit comments