eliboa / NxNandManager

Nintendo Switch NAND management tool : explore, backup, restore, mount, resize, create emunand, etc. (Windows)
GNU General Public License v2.0
794 stars 75 forks source link

"Failed to open file for writing" #100

Open ChtPlayer opened 2 years ago

ChtPlayer commented 2 years ago

Hi, i'm trying to backup saves from a broken nand with a bad "System" partition and getting the error mentioned on the title, only happens with games that have folders in their saves like BotW or n64 NSO, i'm guessing it is trying to create a folder named "/" and windows wont let it do that. debug does not seem to indicate anything useful (maybe i'm just blind).

Captura de pantalla 2022-11-23 112604

gregoo commented 1 year ago

@ChtPlayer I stumbled upon the same issue with Smash Bros.

image

I thought it was the double slash as well but upon reading the QFile doc, it seem this one will fail if the path to the file does not completely exists.

In the code it assumes that all files in a save are not nested, and thus does not try to create the nested dirs before extracting, which fails.

With the dir creation beforehand I'm managing to have a complete extraction.

image

As with the original 5.2 release, even though it asks for an folder before extracting, everything is put directly in C:\ on my computer. I did not try to fix that as it is a minor inconvenience and I am in no way a C++ developper.

image

I've create a release on my fork, based on the current master branch, with an extra commit. https://github.com/gregoo/NxNandManager/releases/tag/master-20221208%2Bextractfs

You will need to bring in the res\hactoolnet.exe file from the official release for everything to work.

Hoping this will help you.

gregoo commented 1 year ago

One of my save isn't working for some reason so your mileage may vary. I don't have a Windows dev environment on hand so I can't really test much more than what I did.

image

blakehan commented 1 year ago

@ChtPlayer I stumbled upon the same issue with Smash Bros.

image

I thought it was the double slash as well but upon reading the QFile doc, it seem this one will fail if the path to the file does not completely exists.

In the code it assumes that all files in a save are not nested, and thus does not try to create the nested dirs before extracting, which fails.

With the dir creation beforehand I'm managing to have a complete extraction.

image

As with the original 5.2 release, even though it asks for an folder before extracting, everything is put directly in C:\ on my computer. I did not try to fix that as it is a minor inconvenience and I am in no way a C++ developper.

image

I've create a release on my fork, based on the current master branch, with an extra commit. https://github.com/gregoo/NxNandManager/releases/tag/master-20221208%2Bextractfs

You will need to bring in the res\hactoolnet.exe file from the official release for everything to work.

Hoping this will help you.

Cannot create folder if there are Japaness characters in the game name. Can you modify the code and just leave the title ID in the path?

blakehan commented 1 year ago

@ChtPlayer I stumbled upon the same issue with Smash Bros. image I thought it was the double slash as well but upon reading the QFile doc, it seem this one will fail if the path to the file does not completely exists. In the code it assumes that all files in a save are not nested, and thus does not try to create the nested dirs before extracting, which fails. With the dir creation beforehand I'm managing to have a complete extraction. image As with the original 5.2 release, even though it asks for an folder before extracting, everything is put directly in C:\ on my computer. I did not try to fix that as it is a minor inconvenience and I am in no way a C++ developper. image I've create a release on my fork, based on the current master branch, with an extra commit. https://github.com/gregoo/NxNandManager/releases/tag/master-20221208%2Bextractfs You will need to bring in the res\hactoolnet.exe file from the official release for everything to work. Hoping this will help you.

Cannot create folder if there are Japaness characters in the game name. Can you modify the code and just leave the title ID in the path?

I think it's simply comment these two lines, but I don't have a windows dev machine to build the project... :(

        if (file->hasAdditionalString("title_name"))
            path.append(" " + QString::fromStdString(file->normalizedTitleLabel()));