Register temporary directory without specifying any names
This commit is contained in:
parent
a2ca866232
commit
1223941007
@ -1403,6 +1403,8 @@ namespace UniversalEditor.UserInterface
|
||||
// overridden with a switch (/basepath:...) ?
|
||||
mvarBasePath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
|
||||
|
||||
TemporaryFileManager.RegisterTemporaryDirectory();
|
||||
|
||||
BeforeInitialization();
|
||||
|
||||
// Initialize the branding for the selected application
|
||||
@ -1421,6 +1423,8 @@ namespace UniversalEditor.UserInterface
|
||||
BookmarksManager.Save();
|
||||
RecentFileManager.Save();
|
||||
ConfigurationManager.Save();
|
||||
|
||||
TemporaryFileManager.UnregisterTemporaryDirectory();
|
||||
}
|
||||
public void RestartApplication()
|
||||
{
|
||||
|
||||
@ -43,6 +43,26 @@ namespace UniversalEditor.UserInterface
|
||||
return filePath;
|
||||
}
|
||||
|
||||
public static bool RegisterTemporaryDirectory()
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
string pathName = System.IO.Path.GetRandomFileName();
|
||||
string path = System.IO.Path.Combine(new string[]
|
||||
{
|
||||
System.IO.Path.GetTempPath(),
|
||||
pathName
|
||||
});
|
||||
|
||||
if (!System.IO.Directory.Exists(path))
|
||||
{
|
||||
System.IO.Directory.CreateDirectory(path);
|
||||
|
||||
mvarTemporaryFilePath = path;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
public static bool RegisterTemporaryDirectory(string prefix, int maxNameLength)
|
||||
{
|
||||
if (mvarTemporaryFilePath != null)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user