Skip to content
This repository was archived by the owner on Jan 17, 2021. It is now read-only.

Commit 72991af

Browse files
committed
fixup! Add flag to sync extensions back to local
1 parent 198dda8 commit 72991af

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

main.go

+9-12
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ func syncUserSettings(host string, back bool) error {
250250
if err != nil {
251251
return err
252252
}
253-
const remoteSettingsDir = ".local/share/code-server/User"
253+
const remoteSettingsDir = ".local/share/code-server/User/"
254254

255255
var (
256256
src = localConfDir + "/"
@@ -270,7 +270,7 @@ func syncExtensions(host string, back bool) error {
270270
if err != nil {
271271
return err
272272
}
273-
const remoteExtensionsDir = ".local/share/code-server/extensions"
273+
const remoteExtensionsDir = ".local/share/code-server/extensions/"
274274

275275
var (
276276
src = localExtensionsDir + "/"
@@ -289,13 +289,10 @@ func rsync(src string, dest string, excludePaths ...string) error {
289289
excludeFlags[i] = "--exclude=" + path
290290
}
291291

292-
cmd := exec.Command("rsync", append(excludeFlags, "-az",
293-
"--progress",
294-
"--stats",
295-
// Without --size-only, synchronizing back always results in a
296-
// full copy. For some reason, rsync with --times doesn't actually
297-
// change modification times on the destination.
298-
"--size-only",
292+
cmd := exec.Command("rsync", append(excludeFlags, "-azvr",
293+
// Only update newer directories, and sync times
294+
// to keep things simple.
295+
"-u", "--times",
299296
"--copy-unsafe-links",
300297
src, dest,
301298
)...,
@@ -314,9 +311,9 @@ func configDir() (string, error) {
314311
var path string
315312
switch runtime.GOOS {
316313
case "linux":
317-
path = os.ExpandEnv("$HOME/.config/Code/User")
314+
path = os.ExpandEnv("$HOME/.config/Code/User/")
318315
case "darwin":
319-
path = os.ExpandEnv("$HOME/Library/Application Support/Code/User")
316+
path = os.ExpandEnv("$HOME/Library/Application Support/Code/User/")
320317
default:
321318
return "", xerrors.Errorf("unsupported platform: %s", runtime.GOOS)
322319
}
@@ -327,7 +324,7 @@ func extensionsDir() (string, error) {
327324
var path string
328325
switch runtime.GOOS {
329326
case "linux", "darwin":
330-
path = os.ExpandEnv("$HOME/.vscode/extensions")
327+
path = os.ExpandEnv("$HOME/.vscode/extensions/")
331328
default:
332329
return "", xerrors.Errorf("unsupported platform: %s", runtime.GOOS)
333330
}

0 commit comments

Comments
 (0)