fix: just create the data directory if the old data directory doesn't exist
This commit is contained in:
1 parent
93279b884a
commit
0b45aea1d0
1 file changed
+4
@@ -54,6 +54,10 @@ func RemoveAppDataDirectory(pluginName, appName string) error {
|
|||||||
// CloneAppData copies the data from one app to another
|
// CloneAppData copies the data from one app to another
|
||||||
func CloneAppData(pluginName string, oldAppName string, newAppName string) error {
|
func CloneAppData(pluginName string, oldAppName string, newAppName string) error {
|
||||||
oldDataDir := GetAppDataDirectory(pluginName, oldAppName)
|
oldDataDir := GetAppDataDirectory(pluginName, oldAppName)
|
||||||
|
if !DirectoryExists(oldDataDir) {
|
||||||
|
return CreateAppDataDirectory(pluginName, newAppName)
|
||||||
|
}
|
||||||
|
|
||||||
newDataDir := GetAppDataDirectory(pluginName, newAppName)
|
newDataDir := GetAppDataDirectory(pluginName, newAppName)
|
||||||
if err := copy.Copy(oldDataDir, newDataDir); err != nil {
|
if err := copy.Copy(oldDataDir, newDataDir); err != nil {
|
||||||
return fmt.Errorf("Unable to clone app data to new location: %v", err.Error())
|
return fmt.Errorf("Unable to clone app data to new location: %v", err.Error())
|
||||||
|
|||||||
Reference in new issue
Block a user