Add GetExpandedRecordingDirectoryBase

For a path "D:/foo/bar-$Y/$M/$T.flv" this will return at least "D:/foo"
(and create "D:/foo" if the directory doesn't exist) or at most
"D:/foo/bar-$Y/$M" with $Y and $M expanded, if those directories exist
This commit is contained in:
palana 2014-09-12 21:12:09 +02:00
parent 30e6f7cb30
commit 4e63676d1a
2 changed files with 22 additions and 0 deletions

View File

@ -139,6 +139,7 @@ public:
};
String ExpandRecordingFilename(String);
String GetExpandedRecordingDirectoryBase(String);
//-------------------------------------------------------------------

View File

@ -145,6 +145,27 @@ String ExpandRecordingFilename(String filename)
return filename;
}
String GetExpandedRecordingDirectoryBase(String path)
{
String expanded = path;
do
{
expanded = ExpandRecordingFilename(path);
if (expanded == path)
break;
if (OSFileIsDirectory(expanded))
break;
path = GetPathDirectory(path);
} while (expanded != path);
CreatePath(expanded);
return expanded;
}
String GetOutputFilename(bool replayBuffer=false)
{
String path = OSGetDefaultVideoSavePath(replayBuffer ? L"\\Replay-$T.flv" : L"\\.flv");