Page MenuHomePhabricator

windows: Fix path for file sanitization
ClosedPublic

Authored by walac on Tue, Jun 23, 8:21 AM.

Details

Summary
> c:\
> cd /windows

Are valid paths. Paths starting with '\' or '/' should be considered
absolute paths.

Test Plan

meson test eina

Diff Detail

Repository
rEFL core/efl
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
walac created this revision.Tue, Jun 23, 8:21 AM
walac requested review of this revision.Tue, Jun 23, 8:21 AM

i've looked at https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file#fully-qualified-vs-relative-paths and i indeed see it can begin with \ (but not /) :

"A file name is relative to the current directory if it does not begin with one of the following etc... "
"A single backslash, for example, "\directory" or "\file.txt". This is also referred to as an absolute path."

i don't know if you should also consider /

walac added a comment.Tue, Jun 23, 9:42 AM

i've looked at https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file#fully-qualified-vs-relative-paths and i indeed see it can begin with \ (but not /) :

"A file name is relative to the current directory if it does not begin with one of the following etc... "
"A single backslash, for example, "\directory" or "\file.txt". This is also referred to as an absolute path."

i don't know if you should also consider /

I didn't look at official docs, however if you go to the command prompt and type "cd /Windows" it works.

i've looked at https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file#fully-qualified-vs-relative-paths and i indeed see it can begin with \ (but not /) :

"A file name is relative to the current directory if it does not begin with one of the following etc... "
"A single backslash, for example, "\directory" or "\file.txt". This is also referred to as an absolute path."

i don't know if you should also consider /

It's common for applications ported to windows to consider both \ and / (e.g. neovim). Maybe it would be a nice idea if EFL accepted both as well? At least in Windows.

i've looked at https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file#fully-qualified-vs-relative-paths and i indeed see it can begin with \ (but not /) :

"A file name is relative to the current directory if it does not begin with one of the following etc... "
"A single backslash, for example, "\directory" or "\file.txt". This is also referred to as an absolute path."

i don't know if you should also consider /

It's common for applications ported to windows to consider both \ and / (e.g. neovim). Maybe it would be a nice idea if EFL accepted both as well? At least in Windows.

we do almost nothing about that. Usually, when one passes a path to a Windows file API, the API changes all the slashes to backslashes

i've looked at https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file#fully-qualified-vs-relative-paths and i indeed see it can begin with \ (but not /) :

"A file name is relative to the current directory if it does not begin with one of the following etc... "
"A single backslash, for example, "\directory" or "\file.txt". This is also referred to as an absolute path."

i don't know if you should also consider /

It's common for applications ported to windows to consider both \ and / (e.g. neovim). Maybe it would be a nice idea if EFL accepted both as well? At least in Windows.

we do almost nothing about that. Usually, when one passes a path to a Windows file API, the API changes all the slashes to backslashes

Hm, so you mean that in EFL's point of view, it doesn't matter if the path is with \\ or /, the only one who would and should care is the underlying OS API (which will then report if the path is or not valid)?

and if an application is not working correctly wrt (back)slashes, then i consider this as a bug

i've looked at https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file#fully-qualified-vs-relative-paths and i indeed see it can begin with \ (but not /) :

"A file name is relative to the current directory if it does not begin with one of the following etc... "
"A single backslash, for example, "\directory" or "\file.txt". This is also referred to as an absolute path."

i don't know if you should also consider /

It's common for applications ported to windows to consider both \ and / (e.g. neovim). Maybe it would be a nice idea if EFL accepted both as well? At least in Windows.

we do almost nothing about that. Usually, when one passes a path to a Windows file API, the API changes all the slashes to backslashes

Hm, so you mean that in EFL's point of view, it doesn't matter if the path is with \\ or /, the only one who would and should care is the underlying OS API (which will then report if the path is or not valid)?

yes

vtorri accepted this revision.Tue, Jun 30, 12:09 PM

i've applied it and unit tests are successful, so ok for it

This revision is now accepted and ready to land.Tue, Jun 30, 12:09 PM
jptiz accepted this revision.Tue, Jun 30, 12:29 PM
stefan_schmidt accepted this revision.Mon, Jul 6, 1:49 AM
This revision was automatically updated to reflect the committed changes.