Skip to content

Commit

Permalink
Add sync property and s/isSyncRoot/syncRoot/
Browse files Browse the repository at this point in the history
  • Loading branch information
prasmussen committed Feb 21, 2016
1 parent 428da4b commit 4b95496
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion drive/sync_download.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func (self *Drive) getSyncRoot(rootId string) (*drive.File, error) {
}

// Ensure directory is a proper syncRoot
if _, ok := f.AppProperties["isSyncRoot"]; !ok {
if _, ok := f.AppProperties["syncRoot"]; !ok {
return nil, fmt.Errorf("Provided id is not a sync root directory")
}

Expand Down
2 changes: 1 addition & 1 deletion drive/sync_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ type ListSyncArgs struct {

func (self *Drive) ListSync(args ListSyncArgs) error {
listArgs := listAllFilesArgs{
query: "appProperties has {key='isSyncRoot' and value='true'}",
query: "appProperties has {key='syncRoot' and value='true'}",
fields: []googleapi.Field{"nextPageToken", "files(id,name,mimeType,createdTime)"},
}
files, err := self.listAllFiles(listArgs)
Expand Down
8 changes: 4 additions & 4 deletions drive/sync_upload.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ func (self *Drive) prepareSyncRoot(args UploadSyncArgs) (*drive.File, error) {
}

// Return directory if syncRoot property is already set
if _, ok := f.AppProperties["isSyncRoot"]; ok {
if _, ok := f.AppProperties["syncRoot"]; ok {
return f, nil
}

Expand All @@ -124,7 +124,7 @@ func (self *Drive) prepareSyncRoot(args UploadSyncArgs) (*drive.File, error) {

// Update directory with syncRoot property
dstFile := &drive.File{
AppProperties: map[string]string{"isSyncRoot": "true"},
AppProperties: map[string]string{"sync": "true", "syncRoot": "true"},
}

f, err = self.service.Files.Update(f.Id, dstFile).Fields(fields...).Do()
Expand Down Expand Up @@ -260,7 +260,7 @@ func (self *Drive) createMissingRemoteDir(args createMissingRemoteDirArgs) (*dri
Name: args.name,
MimeType: DirectoryMimeType,
Parents: []string{args.parentId},
AppProperties: map[string]string{"syncRootId": args.rootId},
AppProperties: map[string]string{"sync": "true", "syncRootId": args.rootId},
}

if args.dryRun {
Expand Down Expand Up @@ -298,7 +298,7 @@ func (self *Drive) uploadMissingFile(parentId string, lf *LocalFile, args Upload
dstFile := &drive.File{
Name: lf.info.Name(),
Parents: []string{parentId},
AppProperties: map[string]string{"syncRootId": args.RootId},
AppProperties: map[string]string{"sync": "true", "syncRootId": args.RootId},
}

// Chunk size option
Expand Down

0 comments on commit 4b95496

Please sign in to comment.