SerGreen / Appacker

Tool for making single .exe application packages
235 stars 29 forks source link

Can`t open files with *space* in name #9

Closed assenizator closed 3 years ago

assenizator commented 3 years ago

If you try to open some file (ex. Photo.jpg) with packed app - it works and image opens with packed app BUT if the file has name with space in path (ex. Photo december 2007.jpg) app will try to open ...\Photo (it doesen`t see any name after space) Please tell me where can I add quotation marks to path in code? What .cs files contain pathes? Or how can I make Packed app open files with spaces in path? Thank you in advanceю

SerGreen commented 3 years ago

Huh, what a peculiar bug. However, it's possible that it's an issue with that specific program that you try to use to open photos. I tried to replicate this and wasn't able to get this bug. Here's what i tried:

  1. Created packed version of IrfanView
  2. Launched packed IrfanView with a double click
  3. Opened image with spaces in name via File > Open dialog

No issues here.

Then i tried to launch packed IrfanView via command line, passing path to an image with spaces as an argument
IrfanPacked.exe "c:\users\sergreen\desktop\Test Image.png" - it opens image with no issues.
I also tried not to put quotation marks around image path and it still works fine.

Can you provide more specific information about this issue? What program did you pack? How do you open images with it - drag and drop / open file dialog / command line argument? Can this program open files with spaces in name when it's not packed with Appacker?

assenizator commented 3 years ago

I tried this with all the programs - VLC, Notepad++ etc. All the same bug I just set packed exe app as default for .jpg for example and clicked on image. Better look at video:

https://user-images.githubusercontent.com/76493798/102974038-e47a2180-450e-11eb-8028-e8eb78801b42.mp4

SO, the bug is located in Appacker or Windows. Because File->Open... works, drag&drop works. I think in some line of code of appacker (in unpacker i think) quotation marks are missing...

SerGreen commented 3 years ago

Aha! Setting it as the default app in Windows does this. Interesting.
I don't think there's a lot of hardcoded paths in the code, so this bug is kinda tricky bug i don't know how to fix it yet. But i'll look into how it can be fixed.

Huh. Not everything behaves this way, for me IrfanView works even when set as default.
However, i was able to replicate this bug with Notepad++ and VLC.

https://user-images.githubusercontent.com/4000373/103023890-7574eb00-4557-11eb-8549-fa523f053e79.mp4

SerGreen commented 3 years ago

Trying to open file via command line also has this issue, it's just mine version of IrfanView seems to be very smart and digests bad arguments anyway, but other apps aren't that smart.

And i think i have fixed it. Indeed, by wrapping every argument with quotation marks.
Unpacker tool receives arguments from the OS already stripped of quotes, so passing them back 'as is' made them appear as multiple arguments instead of a single file path. I tested a few programs with this fix and they seem to be working alright.

assenizator commented 3 years ago

Thank you! Latest update made it work! You are a good developer supporting repositories and helping for free :-)