mirror of
https://github.com/ShareX/ShareX.git
synced 2024-10-01 09:47:22 +13:00
Rename create directory method
This commit is contained in:
parent
d5b66fede7
commit
cd052ea783
5 changed files with 17 additions and 14 deletions
|
@ -908,7 +908,7 @@ public static long GetFileSize(string path)
|
|||
return -1;
|
||||
}
|
||||
|
||||
public static void CreateDirectoryFromDirectoryPath(string directoryPath)
|
||||
public static void CreateDirectory(string directoryPath)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(directoryPath) && !Directory.Exists(directoryPath))
|
||||
{
|
||||
|
@ -930,7 +930,7 @@ public static void CreateDirectoryFromFilePath(string filePath)
|
|||
if (!string.IsNullOrEmpty(filePath))
|
||||
{
|
||||
string directoryPath = Path.GetDirectoryName(filePath);
|
||||
CreateDirectoryFromDirectoryPath(directoryPath);
|
||||
CreateDirectory(directoryPath);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -955,7 +955,7 @@ public static string CopyFile(string filePath, string destinationFolder, bool ov
|
|||
{
|
||||
string fileName = Path.GetFileName(filePath);
|
||||
string destinationFilePath = Path.Combine(destinationFolder, fileName);
|
||||
CreateDirectoryFromDirectoryPath(destinationFolder);
|
||||
CreateDirectory(destinationFolder);
|
||||
File.Copy(filePath, destinationFilePath, overwrite);
|
||||
return destinationFilePath;
|
||||
}
|
||||
|
@ -969,7 +969,7 @@ public static string MoveFile(string filePath, string destinationFolder, bool ov
|
|||
{
|
||||
string fileName = Path.GetFileName(filePath);
|
||||
string destinationFilePath = Path.Combine(destinationFolder, fileName);
|
||||
CreateDirectoryFromDirectoryPath(destinationFolder);
|
||||
CreateDirectory(destinationFolder);
|
||||
|
||||
if (overwrite && File.Exists(destinationFilePath))
|
||||
{
|
||||
|
@ -1015,7 +1015,7 @@ public static string BackupFileWeekly(string filePath, string destinationFolder)
|
|||
|
||||
if (!File.Exists(newFilePath))
|
||||
{
|
||||
CreateDirectoryFromDirectoryPath(destinationFolder);
|
||||
CreateDirectory(destinationFolder);
|
||||
File.Copy(filePath, newFilePath, false);
|
||||
return newFilePath;
|
||||
}
|
||||
|
@ -1035,7 +1035,7 @@ public static void BackupFileMonthly(string filePath, string destinationFolder)
|
|||
|
||||
if (!File.Exists(newFilePath))
|
||||
{
|
||||
CreateDirectoryFromDirectoryPath(destinationFolder);
|
||||
CreateDirectory(destinationFolder);
|
||||
File.Copy(filePath, newFilePath, false);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -161,7 +161,7 @@ private bool SaveInternal(string filePath)
|
|||
{
|
||||
string fileName = Path.GetFileName(filePath);
|
||||
backupFilePath = Path.Combine(BackupFolder, fileName);
|
||||
Helpers.CreateDirectoryFromDirectoryPath(BackupFolder);
|
||||
Helpers.CreateDirectory(BackupFolder);
|
||||
}
|
||||
|
||||
File.Replace(tempFilePath, filePath, backupFilePath);
|
||||
|
|
|
@ -215,7 +215,7 @@ private void StartDownload()
|
|||
btnAction.Text = Resources.DownloaderForm_StartDownload_Cancel;
|
||||
|
||||
string folderPath = Path.Combine(Path.GetTempPath(), "ShareX");
|
||||
Helpers.CreateDirectoryFromDirectoryPath(folderPath);
|
||||
Helpers.CreateDirectory(folderPath);
|
||||
DownloadLocation = Path.Combine(folderPath, Filename);
|
||||
|
||||
fileDownloader = new FileDownloader(URL, DownloadLocation, Proxy, AcceptHeader);
|
||||
|
|
|
@ -178,7 +178,7 @@ private string GetOutputDirectory()
|
|||
break;
|
||||
}
|
||||
|
||||
Helpers.CreateDirectoryFromDirectoryPath(directory);
|
||||
Helpers.CreateDirectory(directory);
|
||||
|
||||
return directory;
|
||||
}
|
||||
|
|
|
@ -474,11 +474,14 @@ private static void UpdatePersonalPath()
|
|||
|
||||
private static void CreateParentFolders()
|
||||
{
|
||||
Helpers.CreateDirectoryFromDirectoryPath(SettingManager.BackupFolder);
|
||||
Helpers.CreateDirectoryFromDirectoryPath(ImageEffectsFolder);
|
||||
Helpers.CreateDirectoryFromDirectoryPath(LogsFolder);
|
||||
Helpers.CreateDirectoryFromDirectoryPath(ScreenshotsParentFolder);
|
||||
Helpers.CreateDirectoryFromDirectoryPath(ToolsFolder);
|
||||
if (Directory.Exists(PersonalFolder))
|
||||
{
|
||||
Helpers.CreateDirectory(SettingManager.BackupFolder);
|
||||
Helpers.CreateDirectory(ImageEffectsFolder);
|
||||
Helpers.CreateDirectory(LogsFolder);
|
||||
Helpers.CreateDirectory(ScreenshotsParentFolder);
|
||||
Helpers.CreateDirectory(ToolsFolder);
|
||||
}
|
||||
}
|
||||
|
||||
private static void MigratePersonalPathConfig()
|
||||
|
|
Loading…
Reference in a new issue