mirror of
https://github.com/gilbertchen/duplicacy
synced 2025-12-06 00:03:38 +00: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
|
||||
}
|
||||
|
||||
// Write directly to the root of the drive
|
||||
if filePath == "" {
|
||||
return fileID, nil
|
||||
}
|
||||
|
||||
names := strings.Split(filePath, "/")
|
||||
current := ""
|
||||
for i, name := range names {
|
||||
|
||||
@@ -582,8 +582,13 @@ func CreateStorage(preference Preference, resetPassword bool, threads int) (stor
|
||||
SavePassword(preference, "gcs_token", tokenFile)
|
||||
return gcsStorage
|
||||
} 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]
|
||||
if len(driveID) != 0 {
|
||||
if driveID != "" {
|
||||
driveID = driveID[:len(driveID)-1]
|
||||
}
|
||||
storagePath := matched[3] + matched[4]
|
||||
|
||||
Reference in New Issue
Block a user