mirror of
https://github.com/jkl1337/duplicacy.git
synced 2026-01-02 11:44:45 -06:00
Fix: backup to shared drive root
Allows writing to the drive root using: gcd://driveid@ or gcd://driveid@/ To write to the root of the default user's drive use the special shared drive named 'root': gcd://root@/
This commit is contained in:
@@ -264,6 +264,11 @@ func (storage *GCDStorage) getIDFromPath(threadIndex int, filePath string, creat
|
|||||||
fileID = rootID
|
fileID = rootID
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Write directly to the root of the drive
|
||||||
|
if filePath == "" {
|
||||||
|
return fileID, nil
|
||||||
|
}
|
||||||
|
|
||||||
names := strings.Split(filePath, "/")
|
names := strings.Split(filePath, "/")
|
||||||
current := ""
|
current := ""
|
||||||
for i, name := range names {
|
for i, name := range names {
|
||||||
|
|||||||
@@ -582,8 +582,13 @@ func CreateStorage(preference Preference, resetPassword bool, threads int) (stor
|
|||||||
SavePassword(preference, "gcs_token", tokenFile)
|
SavePassword(preference, "gcs_token", tokenFile)
|
||||||
return gcsStorage
|
return gcsStorage
|
||||||
} else if matched[1] == "gcd" {
|
} else if matched[1] == "gcd" {
|
||||||
|
// Handle writing directly to the root of the drive
|
||||||
|
// For gcd://driveid@/, driveid@ is match[3] not match[2]
|
||||||
|
if matched[2] == "" && strings.HasSuffix(matched[3], "@") {
|
||||||
|
matched[2], matched[3] = matched[3], matched[2]
|
||||||
|
}
|
||||||
driveID := matched[2]
|
driveID := matched[2]
|
||||||
if len(driveID) != 0 {
|
if driveID != "" {
|
||||||
driveID = driveID[:len(driveID)-1]
|
driveID = driveID[:len(driveID)-1]
|
||||||
}
|
}
|
||||||
storagePath := matched[3] + matched[4]
|
storagePath := matched[3] + matched[4]
|
||||||
|
|||||||
Reference in New Issue
Block a user