[chronojump/michrolab] Renamed GetDataDir->GetChronojumpDir; GetParentDir->GetLocalDataDir
- From: Xavier Padullés <xpadulles src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump/michrolab] Renamed GetDataDir->GetChronojumpDir; GetParentDir->GetLocalDataDir
- Date: Thu, 14 Jul 2022 16:37:53 +0000 (UTC)
commit a80638152d2307f54826d25a38021c05404eb84b
Author: Xavier de Blas <xaviblas gmail com>
Date: Tue Jun 7 16:45:31 2022 +0200
Renamed GetDataDir->GetChronojumpDir; GetParentDir->GetLocalDataDir
src/encoderRProc.cs | 5 +++--
src/gui/app1/session/backup.cs | 4 ++--
src/gui/app1/session/export.cs | 2 +-
src/gui/app1/session/main.cs | 2 +-
src/sqlite/oldConvert.cs | 2 +-
src/util.cs | 22 ++++++++++++----------
src/utilEncoder.cs | 20 ++++++++++----------
7 files changed, 30 insertions(+), 27 deletions(-)
---
diff --git a/src/encoderRProc.cs b/src/encoderRProc.cs
index 477842dc7..c76872fea 100644
--- a/src/encoderRProc.cs
+++ b/src/encoderRProc.cs
@@ -506,9 +506,10 @@ public class EncoderRProcAnalyze : EncoderRProc
}
- private string getEncoderScriptCallGraph() {
+ private string getEncoderScriptCallGraph()
+ {
return System.IO.Path.Combine(
- Util.GetDataDir(), "encoder", Constants.EncoderScriptCallGraph);
+ Util.GetChronojumpDir (), "encoder", Constants.EncoderScriptCallGraph);
}
protected override void writeOptionsFile()
diff --git a/src/gui/app1/session/backup.cs b/src/gui/app1/session/backup.cs
index e28421733..7b7e989fa 100644
--- a/src/gui/app1/session/backup.cs
+++ b/src/gui/app1/session/backup.cs
@@ -430,7 +430,7 @@ public partial class ChronoJumpWindow
sw.Start();
app1s_copyRecursiveSuccess = app1s_uc.CopyFilesRecursively(
- new DirectoryInfo(Util.GetParentDir(false)), new
DirectoryInfo(app1s_fileCopy), 0);
+ new DirectoryInfo(Util.GetLocalDataDir(false)), new
DirectoryInfo(app1s_fileCopy), 0);
sw.Stop();
app1s_copyRecursiveElapsedMs = sw.ElapsedMilliseconds;
@@ -454,7 +454,7 @@ public partial class ChronoJumpWindow
// tarArchive.WriteEntry (tarEntry, true);
//}
//AddDirectoryFilesToTar (tarArchive, Path.Combine
(Config.DBDir, storageName + " attachments"), true);
- AddDirectoryFilesToTar (tarArchive, Util.GetParentDir(false),
true);
+ AddDirectoryFilesToTar (tarArchive,
Util.GetLocalDataDir(false), true);
}
}
}
diff --git a/src/gui/app1/session/export.cs b/src/gui/app1/session/export.cs
index 5c26d20a3..3e4ef29fe 100644
--- a/src/gui/app1/session/export.cs
+++ b/src/gui/app1/session/export.cs
@@ -213,7 +213,7 @@ public partial class ChronoJumpWindow
app1s_exportText = Catalog.GetString("Copying files");
//TODO: copy only needed multimedia (photos), videos are discarded by sessions
- app1s_uc.CopyFilesRecursively(new DirectoryInfo(Util.GetParentDir(false)), new
DirectoryInfo(app1s_fileCopy), 0);
+ app1s_uc.CopyFilesRecursively (new DirectoryInfo(Util.GetLocalDataDir (false)), new
DirectoryInfo (app1s_fileCopy), 0);
//TODO: check that db exists and manage sessionSwitcher to go back
string exportedDB = app1s_fileCopy + System.IO.Path.DirectorySeparatorChar +
diff --git a/src/gui/app1/session/main.cs b/src/gui/app1/session/main.cs
index 973866bc2..122c1f394 100644
--- a/src/gui/app1/session/main.cs
+++ b/src/gui/app1/session/main.cs
@@ -318,7 +318,7 @@ public partial class ChronoJumpWindow
string dir = "";
if(file1.Exists)
- dir = Util.GetParentDir(false);
+ dir = Util.GetLocalDataDir (false);
else if(file2.Exists)
dir = Util.GetDatabaseTempDir();
diff --git a/src/sqlite/oldConvert.cs b/src/sqlite/oldConvert.cs
index 4ccf94b84..8ba1f894e 100644
--- a/src/sqlite/oldConvert.cs
+++ b/src/sqlite/oldConvert.cs
@@ -78,7 +78,7 @@ class SqliteOldConvert : Sqlite
public static void ConvertAbsolutePathsToRelative ()
{
//get parentDir with the final '/' or '\'
- string parentDir = Util.GetParentDir(true);
+ string parentDir = Util.GetLocalDataDir (true);
ConvertAbsolutePathsToRelativeDo(parentDir, "encoder", "videoURL");
ConvertAbsolutePathsToRelativeDo(parentDir, "encoder", "url");
diff --git a/src/util.cs b/src/util.cs
index 1be1405ff..4c0bc2708 100644
--- a/src/util.cs
+++ b/src/util.cs
@@ -963,10 +963,10 @@ public class Util
}
/********** start of LocalApplicationData path ************/
-
+
//parent of database, multimedia and encoder
//if withFinalSeparator, then return a '\' or '/' at the end
- public static string GetParentDir(bool withFinalSeparator) {
+ public static string GetLocalDataDir (bool withFinalSeparator) {
string path = Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
"Chronojump");
@@ -981,14 +981,14 @@ public class Util
//then SELECT: makes it abolute (addURLpath)
//INSERT and UPDATE: makes it relative (removeURLpath)
public static string MakeURLabsolute(string url) {
- string parentDir = Util.GetParentDir(true); //add final '/' or '\'
+ string parentDir = Util.GetLocalDataDir(true); //add final '/' or '\'
if( ! url.StartsWith(parentDir) )
url = parentDir + url;
return url;
}
public static string MakeURLrelative(string url) {
- string parentDir = Util.GetParentDir(true); //add final '/' or '\'
+ string parentDir = Util.GetLocalDataDir(true); //add final '/' or '\'
if( url.StartsWith(parentDir) )
url = url.Replace(parentDir, "");
@@ -1316,7 +1316,7 @@ public class Util
/********** end of multimedia paths ************/
public static string GetThemeDir() {
- return Path.Combine(GetDataDir(), "theme");
+ return Path.Combine(GetChronojumpDir (), "theme");
}
public static string GetThemeFile() {
return Path.Combine(GetThemeDir(), "gtk-2.0" + Path.DirectorySeparatorChar + "gtkrc");
@@ -1379,17 +1379,19 @@ public class Util
return baseDirectory;
}
- public static string GetDataDir(){
+ public static string GetChronojumpDir ()
+ {
return System.IO.Path.Combine(GetPrefixDir(),
"share" + Path.DirectorySeparatorChar + "chronojump");
}
- public static string GetImagesDir(){
- return System.IO.Path.Combine(GetDataDir(),"images");
+ public static string GetImagesDir ()
+ {
+ return System.IO.Path.Combine (GetChronojumpDir (),"images");
}
public static string GetCssDir(){
- return GetDataDir();
+ return GetChronojumpDir( );
}
//currently sounds are inside images folder
@@ -1453,7 +1455,7 @@ public class Util
//TODO: maybe this will need a thread
public static int GetFullDataSize (bool includingOldBackupsDir)
{
- long fullDataSize = DirSizeWithSubdirs (new DirectoryInfo(GetParentDir(false)));
+ long fullDataSize = DirSizeWithSubdirs (new DirectoryInfo( GetLocalDataDir(false)));
int sizeInKB = (int) UtilAll.DivideSafe(fullDataSize, 1024);
if(! includingOldBackupsDir)
diff --git a/src/utilEncoder.cs b/src/utilEncoder.cs
index f14e5ec00..9f7df92f9 100644
--- a/src/utilEncoder.cs
+++ b/src/utilEncoder.cs
@@ -185,42 +185,42 @@ public class UtilEncoder
"bin" + Path.DirectorySeparatorChar + "encoder",
Constants.EncoderScriptCapturePythonWindows);
else
return System.IO.Path.Combine(
- Util.GetDataDir(), "encoder",
Constants.EncoderScriptCapturePythonLinux);
+ Util.GetChronojumpDir(), "encoder",
Constants.EncoderScriptCapturePythonLinux);
}
*/
public static string GetEncoderScriptCallCaptureNoRdotNet() {
return System.IO.Path.Combine(
- Util.GetDataDir(), "encoder", Constants.EncoderScriptCallCaptureNoRDotNet);
+ Util.GetChronojumpDir(), "encoder",
Constants.EncoderScriptCallCaptureNoRDotNet);
}
public static string GetEncoderScriptCaptureNoRdotNet() {
return System.IO.Path.Combine(
- Util.GetDataDir(), "encoder", Constants.EncoderScriptCaptureNoRDotNet);
+ Util.GetChronojumpDir(), "encoder", Constants.EncoderScriptCaptureNoRDotNet);
}
public static string GetEncoderScriptGraph() {
return System.IO.Path.Combine(
- Util.GetDataDir(), "encoder", Constants.EncoderScriptGraph);
+ Util.GetChronojumpDir(), "encoder", Constants.EncoderScriptGraph);
}
private static string getEncoderScriptInertiaMomentum() {
return System.IO.Path.Combine(
- Util.GetDataDir(), "encoder", Constants.EncoderScriptInertiaMomentum);
+ Util.GetChronojumpDir(), "encoder", Constants.EncoderScriptInertiaMomentum);
}
public static string GetEncoderScriptNeuromuscularProfile() {
return System.IO.Path.Combine(
- Util.GetDataDir(), "encoder", Constants.EncoderScriptNeuromuscularProfile);
+ Util.GetChronojumpDir(), "encoder",
Constants.EncoderScriptNeuromuscularProfile);
}
public static string GetEncoderScriptUtilR() {
return System.IO.Path.Combine(
- Util.GetDataDir(), "encoder", Constants.EncoderScriptUtilR);
+ Util.GetChronojumpDir(), "encoder", Constants.EncoderScriptUtilR);
}
public static string GetEncoderScriptsPathWithoutLastSep() {
- string s = System.IO.Path.Combine(Util.GetDataDir(), "encoder");
+ string s = System.IO.Path.Combine(Util.GetChronojumpDir(), "encoder");
//but send it without the final '\' or '/' (if found)
if(s.EndsWith("/") || s.EndsWith("\\"))
@@ -237,7 +237,7 @@ public class UtilEncoder
/********** start of r-scripts paths ************/
public static string GetSprintPath() {
- return System.IO.Path.Combine(Util.GetDataDir(), "r-scripts");
+ return System.IO.Path.Combine(Util.GetChronojumpDir(), "r-scripts");
}
public static string GetSprintPhotocellsScript() {
return System.IO.Path.Combine(GetSprintPath(), "sprintPhotocells.R");
@@ -254,7 +254,7 @@ public class UtilEncoder
}
public static string GetScriptsPath() {
- return System.IO.Path.Combine(Util.GetDataDir(), "r-scripts");
+ return System.IO.Path.Combine(Util.GetChronojumpDir(), "r-scripts");
}
public static string GetmifScript() {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]