joel16 / NX-Shell

A multi-purpose file manager for the Nintendo Switch.
GNU General Public License v2.0
957 stars 66 forks source link

It is not possible to create new folders and files in the root directory #93

Closed muxi1 closed 2 years ago

muxi1 commented 3 years ago

Hi joel16,

I don't know if you know this, but under v3.2.0 you cannot create folders and files in the SD card root.

fennectech commented 3 years ago

Ill check it out to see if i can reproduce.

zand commented 3 years ago

My current OS version is 12.1.0|AMS M.19.5|E and as of 097ac82, I was able to reproduce this.

Looking at the following source code https://github.com/joel16/NX-Shell/blob/097ac8225ca67212d9dac76f01d7214145e1898e/source/popups/options.cpp#L76-L106 I determined that creating "New File" in the root directory results in the file path being "//New File" instead of "/New File" witch could possibly result in an error depending how paths are handled in fsFsCreateFile and fsFsCreateDirectory.

I tried changing path.append("/"); to if (path.compare("/")) path.append("/"); and confirmed that path "/New File" was being passed to fsFsCreateFile but it still did resulted no file being created in the root directory.

At this point I think that this may be an issue in fsFsCreateFile witch seem to simply dispatch the "OpenFileSystem" cmd to fsp-srv. https://switchbrew.org/wiki/Filesystem_services#OpenFileSystem

joel16 commented 2 years ago

Should be fixed with v4.0.0. I was able to create folders on root.