diff options
| author | Petter Rasmussen | 2016-02-08 23:05:11 +0100 | 
|---|---|---|
| committer | Petter Rasmussen | 2016-02-08 23:05:11 +0100 | 
| commit | db952bdd07a69023f6fcc18f4de4ed0bfba5d319 (patch) | |
| tree | be9bdfdb5bbbebf6ee0ea686be189f1670c10910 /drive | |
| parent | 48221145e64d65fb7afc1dba40e6f41bb7b76e7d (diff) | |
| download | gdrive-db952bdd07a69023f6fcc18f4de4ed0bfba5d319.tar.bz2 | |
Print relative path, etc
Diffstat (limited to 'drive')
| -rw-r--r-- | drive/sync_download.go | 20 | ||||
| -rw-r--r-- | drive/sync_upload.go | 4 | 
2 files changed, 11 insertions, 13 deletions
| diff --git a/drive/sync_download.go b/drive/sync_download.go index 20ff87d..d918858 100644 --- a/drive/sync_download.go +++ b/drive/sync_download.go @@ -101,17 +101,17 @@ func (self *Drive) createMissingLocalDirs(files *syncFiles, args DownloadSyncArg      sort.Sort(byRemotePathLength(missingDirs))      for i, rf := range missingDirs { -        path, err := filepath.Abs(filepath.Join(args.Path, rf.relPath)) +        absPath, err := filepath.Abs(filepath.Join(args.Path, rf.relPath))          if err != nil {              return fmt.Errorf("Failed to determine local absolute path: %s", err)          } -        fmt.Fprintf(args.Out, "[%04d/%04d] Creating directory: %s\n", i + 1, missingCount, path) +        fmt.Fprintf(args.Out, "[%04d/%04d] Creating directory %s\n", i + 1, missingCount, filepath.Join(filepath.Base(args.Path), rf.relPath))          if args.DryRun {              continue          } -        mkdir(path) +        os.MkdirAll(absPath, 0775)      }      return nil @@ -126,18 +126,17 @@ func (self *Drive) downloadMissingFiles(files *syncFiles, args DownloadSyncArgs)      }      for i, rf := range missingFiles { -        remotePath := filepath.Join(files.root.file.Name, rf.relPath) -        localPath, err := filepath.Abs(filepath.Join(args.Path, rf.relPath)) +        absPath, err := filepath.Abs(filepath.Join(args.Path, rf.relPath))          if err != nil {              return fmt.Errorf("Failed to determine local absolute path: %s", err)          } -        fmt.Fprintf(args.Out, "[%04d/%04d] Downloading %s -> %s\n", i + 1, missingCount, remotePath, localPath) +        fmt.Fprintf(args.Out, "[%04d/%04d] Downloading %s -> %s\n", i + 1, missingCount, rf.relPath, filepath.Join(filepath.Base(args.Path), rf.relPath))          if args.DryRun {              continue          } -        err = self.downloadRemoteFile(rf.file.Id, localPath, args, 0) +        err = self.downloadRemoteFile(rf.file.Id, absPath, args, 0)          if err != nil {              return err          } @@ -155,18 +154,17 @@ func (self *Drive) downloadChangedFiles(files *syncFiles, args DownloadSyncArgs)      }      for i, cf := range changedFiles { -        remotePath := filepath.Join(files.root.file.Name, cf.remote.relPath) -        localPath, err := filepath.Abs(filepath.Join(args.Path, cf.remote.relPath)) +        absPath, err := filepath.Abs(filepath.Join(args.Path, cf.remote.relPath))          if err != nil {              return fmt.Errorf("Failed to determine local absolute path: %s", err)          } -        fmt.Fprintf(args.Out, "[%04d/%04d] Downloading %s -> %s\n", i + 1, changedCount, remotePath, localPath) +        fmt.Fprintf(args.Out, "[%04d/%04d] Downloading %s -> %s\n", i + 1, changedCount, cf.remote.relPath, filepath.Join(filepath.Base(args.Path), cf.remote.relPath))          if args.DryRun {              continue          } -        err = self.downloadRemoteFile(cf.remote.file.Id, localPath, args, 0) +        err = self.downloadRemoteFile(cf.remote.file.Id, absPath, args, 0)          if err != nil {              return err          } diff --git a/drive/sync_upload.go b/drive/sync_upload.go index f5bc48b..ca81b5c 100644 --- a/drive/sync_upload.go +++ b/drive/sync_upload.go @@ -179,7 +179,7 @@ func (self *Drive) uploadMissingFiles(files *syncFiles, args UploadSyncArgs) err              return fmt.Errorf("Could not find remote directory with path '%s'", parentPath)          } -        fmt.Fprintf(args.Out, "[%04d/%04d] Uploading %s -> %s\n", i + 1, missingCount, lf.absPath, filepath.Join(files.root.file.Name, lf.relPath)) +        fmt.Fprintf(args.Out, "[%04d/%04d] Uploading %s -> %s\n", i + 1, missingCount, lf.relPath, filepath.Join(files.root.file.Name, lf.relPath))          if args.DryRun {              continue @@ -203,7 +203,7 @@ func (self *Drive) updateChangedFiles(files *syncFiles, args UploadSyncArgs) err      }      for i, cf := range changedFiles { -        fmt.Fprintf(args.Out, "[%04d/%04d] Updating %s -> %s\n", i + 1, changedCount, cf.local.absPath, filepath.Join(files.root.file.Name, cf.local.relPath)) +        fmt.Fprintf(args.Out, "[%04d/%04d] Updating %s -> %s\n", i + 1, changedCount, cf.local.relPath, filepath.Join(files.root.file.Name, cf.local.relPath))          if args.DryRun {              continue | 
