config: Move our tmp dir into config dir
This commit is contained in:
parent
cde01d1166
commit
83ffa724d1
|
@ -343,9 +343,6 @@ namespace SparkleShare {
|
|||
void DetectRepositoryRenames ()
|
||||
{
|
||||
foreach (string group_path in Directory.GetDirectories (Config.FoldersPath)) {
|
||||
if (group_path.EndsWith (".tmp"))
|
||||
continue;
|
||||
|
||||
foreach (string folder_path in Directory.GetDirectories (group_path)) {
|
||||
string folder_name = Path.GetFileName (folder_path);
|
||||
|
||||
|
@ -557,10 +554,6 @@ namespace SparkleShare {
|
|||
|
||||
public void StartFetcher (SparkleFetcherInfo info)
|
||||
{
|
||||
Directory.Delete (Config.TmpPath, true);
|
||||
Directory.CreateDirectory (Config.TmpPath);
|
||||
File.SetAttributes (Config.TmpPath, File.GetAttributes (Config.TmpPath) | FileAttributes.Hidden);
|
||||
|
||||
string canonical_name = Path.GetFileName (info.RemotePath);
|
||||
string backend = info.Backend;
|
||||
|
||||
|
@ -569,6 +562,9 @@ namespace SparkleShare {
|
|||
|
||||
info.TargetDirectory = Path.Combine (Config.TmpPath, canonical_name);
|
||||
|
||||
if (Directory.Exists (info.TargetDirectory))
|
||||
Directory.Delete (info.TargetDirectory);
|
||||
|
||||
try {
|
||||
this.fetcher = (BaseFetcher) Activator.CreateInstance (
|
||||
Type.GetType ("Sparkles." + backend + "." + backend + "Fetcher, Sparkles." + backend),
|
||||
|
@ -678,7 +674,6 @@ namespace SparkleShare {
|
|||
}
|
||||
}
|
||||
|
||||
Directory.Delete (Config.TmpPath, true);
|
||||
string backend = BaseFetcher.GetBackend (this.fetcher.RemoteUrl.ToString ());
|
||||
|
||||
Config.AddFolder (target_folder_name, identifier, this.fetcher.RemoteUrl.ToString (), backend);
|
||||
|
|
|
@ -30,6 +30,7 @@ namespace Sparkles {
|
|||
public readonly string DirectoryPath;
|
||||
public readonly string FilePath;
|
||||
public readonly string TmpPath;
|
||||
public readonly string BinPath;
|
||||
public readonly string LogFilePath;
|
||||
|
||||
|
||||
|
@ -58,12 +59,17 @@ namespace Sparkles {
|
|||
FilePath = Path.Combine (config_path, config_file_name);
|
||||
DirectoryPath = config_path;
|
||||
|
||||
BinPath = Path.Combine (config_path, "bin");
|
||||
|
||||
if (!Directory.Exists (BinPath))
|
||||
Directory.CreateDirectory (BinPath);
|
||||
|
||||
string logs_path = Path.Combine (config_path, "logs");
|
||||
|
||||
int i = 1;
|
||||
do {
|
||||
LogFilePath = Path.Combine (
|
||||
logs_path, "debug_log_" + DateTime.Now.ToString ("yyyy-MM-dd") + "." + i + ".txt");
|
||||
logs_path, "log_" + DateTime.Now.ToString ("yyyy-MM-dd") + "." + i + ".txt");
|
||||
|
||||
i++;
|
||||
|
||||
|
@ -73,7 +79,7 @@ namespace Sparkles {
|
|||
Directory.CreateDirectory (logs_path);
|
||||
|
||||
// Delete logs older than a week
|
||||
foreach (FileInfo file in new DirectoryInfo (logs_path).GetFiles ("debug_log*.txt")) {
|
||||
foreach (FileInfo file in new DirectoryInfo (logs_path).GetFiles ("log*.txt")) {
|
||||
if (file.LastWriteTime < DateTime.Now.AddDays (-7))
|
||||
file.Delete ();
|
||||
}
|
||||
|
@ -103,7 +109,7 @@ namespace Sparkles {
|
|||
|
||||
} finally {
|
||||
Load (FilePath);
|
||||
TmpPath = Path.Combine (FoldersPath, ".tmp");
|
||||
TmpPath = Path.Combine (DirectoryPath, "tmp");
|
||||
Directory.CreateDirectory (TmpPath);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue