fix: just create the data directory if the old data directory doesn't exist

This commit is contained in:
Jose Diaz-Gonzalez
2023-01-10 02:10:06 -05:00
parent 93279b884a
commit 0b45aea1d0

View File

@@ -54,6 +54,10 @@ func RemoveAppDataDirectory(pluginName, appName string) error {
// CloneAppData copies the data from one app to another
func CloneAppData(pluginName string, oldAppName string, newAppName string) error {
oldDataDir := GetAppDataDirectory(pluginName, oldAppName)
if !DirectoryExists(oldDataDir) {
return CreateAppDataDirectory(pluginName, newAppName)
}
newDataDir := GetAppDataDirectory(pluginName, newAppName)
if err := copy.Copy(oldDataDir, newDataDir); err != nil {
return fmt.Errorf("Unable to clone app data to new location: %v", err.Error())