You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.
Hi. I've been investigating a broken behavior in Atom, and traced it down to this library.
In short, if you create a Directory for C:\ like so:
varpw=require("pathwatcher");vard=newpw.Directory("C:\\");console.log(d.path);// "C:" is printed
... the path is normalized to C: (see directory.cofee; introduced in 0630c38). This normalization is incorrect; path should remain at C:\.
The problem is that libaries like node's path recognize C:\ as an absolute directory (path.isAbsolute("C:\\") is true), but not C: (path.isAbsolute("C:") is false). This, among other things, leads to various problems when you pass C:, where C:\ should have been.
The impact of the problem is this: when you add a project path to Atom and select a drive, like C: (or, Z: in my case; it's a network mapped drive), atom.pickFolder returns path in the correct form C:\. After you exit Atom, ~/.atom/storage says that initialPath is actually C:. This is due to normalization that pathwatcher performs (note that path.normalize and fs-plus.absolute all preserve the final slash). When you reopen Atom, it will try to create a new file called C (located in Atom's installation path) in addition to opening directories. This behavior is bogus, and does not happen if initialPath is set to C:\.
I think pathwatcher should change it's normalization somehow. Maybe abolish it altogether. Maybe always add a trailing slash instead of removing it. Whatever you think is best. I look forward to not having my Atom broken.
The text was updated successfully, but these errors were encountered:
I've experienced a similar issue which I think this is the cause of.
When I go to create a new file in a project by right-clicking on a folder and choosing New File the pre-filled file path in the resulting popup misses off the drive's backslash as @magv has outlined above. This produces the following error on submitting the proposed file name:
Manually adding the backslash to the drive fixes the issue, obviously, but it's a bit of a minor inconvenience having to do it every time.
I must say I'm suprised nobody else has mentioned this already (unless I've just missed the boat on that one?) since adding a file must be a common action, no?
Hi. I've been investigating a broken behavior in Atom, and traced it down to this library.
In short, if you create a
Directory
forC:\
like so:... the path is normalized to
C:
(see directory.cofee; introduced in 0630c38). This normalization is incorrect; path should remain atC:\
.The problem is that libaries like node's
path
recognizeC:\
as an absolute directory (path.isAbsolute("C:\\")
is true), but notC:
(path.isAbsolute("C:")
is false). This, among other things, leads to various problems when you passC:
, whereC:\
should have been.The impact of the problem is this: when you add a project path to Atom and select a drive, like
C:
(or,Z:
in my case; it's a network mapped drive),atom.pickFolder
returns path in the correct formC:\
. After you exit Atom,~/.atom/storage
says thatinitialPath
is actuallyC:
. This is due to normalization that pathwatcher performs (note thatpath.normalize
andfs-plus.absolute
all preserve the final slash). When you reopen Atom, it will try to create a new file calledC
(located in Atom's installation path) in addition to opening directories. This behavior is bogus, and does not happen ifinitialPath
is set toC:\
.I think pathwatcher should change it's normalization somehow. Maybe abolish it altogether. Maybe always add a trailing slash instead of removing it. Whatever you think is best. I look forward to not having my Atom broken.
The text was updated successfully, but these errors were encountered: