ayurmedia/atom-sync-cygwin

Uncaught Error: Directory should be a string

Closed this issue · 8 comments

  1. Configure .sync-config.cson with the following:
remote:
  host: "internal-host"
  user: "ternstor"
  path: "repos/demo"
behaviour:
  uploadOnSave: true
  syncDownOnOpen: true
  forgetConsole: false
  autoHideConsole: true
  alwaysSyncAll: false
option:
  deleteFiles: false
  exclude: [
    ".sync-config.cson"
    "node_modules"
    "tmp"
    "vendor"
  ]
  1. Right click on demo project folder.
  2. Click on "Sync" -> "Sync Remote -> Local".

Atom: 1.20.0-beta3 x64
Electron: 1.6.9
OS: Mac OS X 10.12.6
Thrown From: atom-sync-cygwin package 0.9.16

Stack Trace

Uncaught Error: Directory should be a string

At /Users/ternstor/.atom/packages/atom-sync-cygwin/node_modules/rsync/rsync.js:415

Error: Directory should be a string
    at Rsync.cwd (/packages/atom-sync-cygwin/node_modules/rsync/rsync.js:415:19)
    at module.exports (/packages/atom-sync-cygwin/lib/service/rsync-service.coffee:45:9)
    at Object.sync (/packages/atom-sync-cygwin/lib/controller/service-controller.coffee:98:5)
    at Object.onSync (/packages/atom-sync-cygwin/lib/controller/service-controller.coffee:77:6)
    at /packages/atom-sync-cygwin/lib/atom-sync-cygwin.coffee:27:19)
    at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (/Applications/Atom Beta.app/Contents/Resources/app/src/command-registry.js:265:35)
    at CommandRegistry.handleCommandEvent (/Applications/Atom Beta.app/Contents/Resources/app/src/command-registry.js:3:65)
    at CommandRegistry.module.exports.CommandRegistry.dispatch (/Applications/Atom Beta.app/Contents/Resources/app/src/command-registry.js:166:25)
    at AtomEnvironment.module.exports.AtomEnvironment.dispatchContextMenuCommand (/Applications/Atom Beta.app/Contents/Resources/app/src/atom-environment.js:1344:34)
    at EventEmitter.outerCallback (/Applications/Atom Beta.app/Contents/Resources/app/src/application-delegate.js:348:31)
    at emitThree (events.js:116:13)
    at EventEmitter.emit (events.js:194:7)

Commands

     -7:18.6.0 atom-sync-cygwin:download-directory (div.header.list-item.project-root-header)
     -6:51.4.0 core:copy (atom-notification.fatal.icon.icon-bug.native-key-bindings.has-detail.has-close.has-stack)
     -5:35.1.0 atom-sync-cygwin:configure (div.header.list-item.project-root-header)
     -5:19.1.0 core:paste (input.hidden-input)
     -5:18.4.0 core:backspace (input.hidden-input)
     -5:18.2.0 core:save (input.hidden-input)
     -4:36 atom-sync-cygwin:download-directory (div.header.list-item.project-root-header)
     -4:33.4.0 core:copy (atom-notification.fatal.icon.icon-bug.native-key-bindings.has-detail.has-close.has-stack)
  5x -2:15.2.0 atom-sync-cygwin:download-directory (div.header.list-item.project-root-header)

Non-Core Packages

atom-beautify 0.30.5 
atom-sync-cygwin 0.9.16 
MagicPython 1.0.12 
Sublime-Style-Column-Selection 1.7.4 

I see you are using Beta Version 1.20 of Atom. This was only tested up to 1.19 Stable (Default Auto-Update).

The Error is triggered by this Call "relativizePath".
https://atom.io/docs/api/v1.19.2/Project#instance-relativizePath

in 1.19 Api it returns an array with 2 elements, the [..] = ... syntax in coffee script probably grabs the first element of the array.

i cannot see a documentation for 1.20 api.
my guess is that the return value has changed causing the error.

in 1.19 i didn't notice this problem.

i will try to install Atom 1.20 to reproduce the problem.

i recently merged the relative-path feature from a pull-request from atom-sync , which might cause this effect. but it should be fine.
https://github.com/ayurmedia/atom-sync-cygwin/pull/4/files
original pull request:
dingjie#49

Maybe its an api change from 1.19 => 1.20.
Atom breaks API all the time. For example the menu etc.

edit:
after some research it seems the file defining relativzePath didn't change from 1.19 to 1.20
https://github.com/atom/atom/blob/1.20-releases/spec/project-spec.coffee

i see you are using relativ path , because "repos/demo" does not start with a "/" at the beginning,
so it will look relative to your root-folder of your current project.

If you Data is on "/repos/demo" then you have to add the "/" at the beginning.

My Guess is the "directory should be string" is a result of "Directory not found" which then returns "null" which is not a string.

Please confirm that you want "/path/to/my/project/repos/demo" and not "/repos/demo" in absolute terms.

still there could be a error-check in the line returning "projectPath" and give a warning if the directory (base + relative) does not exists. instead of "is not string".

Probably not much use testing in 1.20 because the API didn't change. my guess its an error in your configuration and a odd warning "not string" instead of "directory not found".

i might add the error-check for the directory-exists and a console-output (where the sync console appears) with the "directory not found message, please check your configuration for relative paths".

compared to before probably the error output is different, before if the directory was not found, simply rsync would return an error which gives the message "check your config".
now with this rsync.cwd(projectdir) a new response is triggered when the directory fails.
...

to clarify. if you use absolute paths (starting with "/..." then the pull-request merge makes no difference, because then the cwd(projectdir) is ignored, because the path redefines the complete location.

but thanks for your feedback and bugreport, because it helps to make better error messages in atom-sync and improves user-experience.

I have the same problem.
If I sync with save, everything works fine. Just if I use the "Sync Remote -> Local".

And I don't use relative path, and the path exists.

i see there is a difference of sending one file with onSave, or sync from the context-menu of the directory/folder menu.

ok this pullrequest seems to have bugs, so i will roll it back and remove the change, until a better version exists. probably < 1% are using these odd relative paths.
dingjie#49

next version will remove the changes.

Can you give me an ETA?

i reverted the changes (pull request 5) and published 0.9.17 which is now same as 0.9.15 which worked fine.
it should already show up in your atom update panel.

Works now again, thanks.

ok, then i close this issue, as 0.9.15 was ok. no need for further testing.

Works for me too. Thanks for the fast response!