mirror of
https://github.com/mRemoteNG/mRemoteNG.git
synced 2026-02-17 22:11:48 +08:00
Safely migrate external tools configuration file from Local to Roaming folder.
This commit is contained in:
@@ -784,7 +784,6 @@ Namespace App
|
||||
End If
|
||||
Else
|
||||
If My.Settings.LoadConsFromCustomLocation = False Then
|
||||
conL.ConnectionFileName = App.Info.Connections.DefaultConnectionsPath & "\" & App.Info.Connections.DefaultConnectionsFile
|
||||
Dim oldPath As String = GetFolderPath(SpecialFolder.LocalApplicationData) & "\" & My.Application.Info.ProductName & "\" & App.Info.Connections.DefaultConnectionsFile
|
||||
Dim newPath As String = App.Info.Connections.DefaultConnectionsPath & "\" & App.Info.Connections.DefaultConnectionsFile
|
||||
If Not File.Exists(newPath) And File.Exists(oldPath) Then
|
||||
|
||||
@@ -2,6 +2,7 @@ Imports System.IO
|
||||
Imports WeifenLuo.WinFormsUI.Docking
|
||||
Imports mRemoteNG.App.Runtime
|
||||
Imports System.Xml
|
||||
Imports System.Environment
|
||||
|
||||
Namespace Config
|
||||
Namespace Settings
|
||||
@@ -172,13 +173,17 @@ Namespace Config
|
||||
End Sub
|
||||
|
||||
Public Sub LoadExternalAppsFromXML()
|
||||
If File.Exists(App.Info.Settings.SettingsPath & "\" & App.Info.Settings.ExtAppsFilesName) = False Then
|
||||
Dim oldPath As String = GetFolderPath(SpecialFolder.LocalApplicationData) & "\" & My.Application.Info.ProductName & "\" & App.Info.Settings.ExtAppsFilesName
|
||||
Dim newPath As String = App.Info.Settings.SettingsPath & "\" & App.Info.Settings.ExtAppsFilesName
|
||||
Dim xDom As New XmlDocument()
|
||||
If File.Exists(newPath) Then
|
||||
xDom.Load(newPath)
|
||||
ElseIf File.Exists(oldPath) Then
|
||||
xDom.Load(oldPath)
|
||||
Else
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Dim xDom As New XmlDocument()
|
||||
xDom.Load(App.Info.Settings.SettingsPath & "\" & App.Info.Settings.ExtAppsFilesName)
|
||||
|
||||
For Each xEl As XmlElement In xDom.DocumentElement.ChildNodes
|
||||
Dim extA As New Tools.ExternalApp
|
||||
extA.DisplayName = xEl.Attributes("DisplayName").Value
|
||||
|
||||
Reference in New Issue
Block a user