Skip to content

Commit

Permalink
Optimize backup
Browse files Browse the repository at this point in the history
  • Loading branch information
2dust committed Sep 16, 2024
1 parent 233d605 commit 8505f2d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions v2rayN/ServiceLib/Common/FileManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,10 @@ public static void CopyDirectory(string sourceDir, string destinationDir, bool r
{
continue;
}
if (file.Extension == file.Name)
{
continue;
}
string targetFilePath = Path.Combine(destinationDir, file.Name);
file.CopyTo(targetFilePath);
}
Expand Down
2 changes: 1 addition & 1 deletion v2rayN/ServiceLib/ViewModels/BackupAndRestoreViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ private async Task<bool> CreateZipFileFromDirectory(string fileName)
var configDirZipTemp = Utils.GetTempPath($"v2rayN_{DateTime.Now:yyyyMMddHHmmss}");
var configDirTemp = Path.Combine(configDirZipTemp, "guiConfigs");

await Task.Run(() => FileManager.CopyDirectory(configDir, configDirTemp, true, "cache.db"));
await Task.Run(() => FileManager.CopyDirectory(configDir, configDirTemp, false, "cache.db"));
var ret = await Task.Run(() => FileManager.CreateFromDirectory(configDirZipTemp, fileName));
await Task.Run(() => Directory.Delete(configDirZipTemp, true));
return ret;
Expand Down

0 comments on commit 8505f2d

Please sign in to comment.