mRemoteNG icon indicating copy to clipboard operation
mRemoteNG copied to clipboard

(Improvement) Writes config files into individual setting folder when in portable mode

Open HorseLuke opened this issue 2 years ago • 2 comments

When mRemoteNG is in portable mode, app should writes config files (.xml) and backup files (.backup) into individual setting folder, not into root directory where exe file exist.

Expected Behavior

When mRemoteNG is in portable mode, new version should writes config files (.xml) and backup files (.backup) into individual setting folder.

Current Behavior

When mRemoteNG is in portable mode, current version writes config files (.xml) and backup files (.backup) into root directory where exe file exist.

Possible Solution

 mRemoteNG/App/Info/SettingsFileInfo.cs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mRemoteNG/App/Info/SettingsFileInfo.cs b/mRemoteNG/App/Info/SettingsFileInfo.cs
index 1f0a2404..abb3faf4 100644
--- a/mRemoteNG/App/Info/SettingsFileInfo.cs
+++ b/mRemoteNG/App/Info/SettingsFileInfo.cs
@@ -12,7 +12,7 @@ namespace mRemoteNG.App.Info
     {
         private static readonly string ExePath = Path.GetDirectoryName(Assembly.GetAssembly(typeof(ConnectionInfo))?.Location);
 
-        public static string SettingsPath => Runtime.IsPortableEdition ? ExePath : Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\" + Application.ProductName;
+        public static string SettingsPath => Runtime.IsPortableEdition ? ( ExePath + "\\" + "PortableEditionSettings") : (Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\" + Application.ProductName);
 
         public static string LayoutFileName { get; } = "pnlLayout.xml";
         public static string ExtAppsFilesName { get; } = "extApps.xml";

Steps to Reproduce (for bugs)

(Not a bug)

Context

After this change, move and backup setting files (.xml and .backup) will be easier.

Your Environment

  • Version used: v1.77.3-dev
  • Operating System and version: Windows 11

HorseLuke avatar Oct 06 '23 05:10 HorseLuke

One more thing.

Should another config file user.config (located in C:\Users\[username]\AppData\Local\mRemoteNG\mRemoteNG_Url_[id]\[version]) writes into such new individual setting folder when in portable mode? But it will break per-user setting behavior, and change this behavior seems not easy. I'm not familier with .net

HorseLuke avatar Oct 06 '23 05:10 HorseLuke

in new version configuration bits are kept in same folder where mR is installed and perhaps will turn in to fully portable mode, so no files are creating outside of installation folder.

Kvarkas avatar Oct 09 '23 09:10 Kvarkas