Bug: Opening items doesn't pass correct path to launched application
[!Important] Current workaround: https://github.com/files-community/Files/issues/12950#issuecomment-1704396874
Description
I have a .jar file for Minceraft java edition. It a custom launcher that I compile and I run from a folder on my desktop. https://github.com/SKCraft/Launcher
After using FIles to access this folder and launching the file.. normally what happens is the jar file accesses the configuration files saved locally in the same folder as the jar file. One in particular is the accounts.dat file with the credentials for my Microsoft account.
When using "Files" it fails to register anything in this folder. Somehow through some registered variable in windows (I assume) it creates a folder in the same general folder location for the launcher project it was compiled in. It does NOT use the Desktop folder I created for the launcher. I have never in any other computer (including OSX or Linux) seen the jar file not being able to access these local files....
FYI, I use a bat file located on my NAS to compile the SKCraft Launcher Minecraft .jar file. This jar file is shared with my son and other nephews to use on their computers as is.. They simply run it and it creates all the local files you see in the included image.
Steps To Reproduce
- Run a program file in
C:/Users/<name>/downloads - See the program get path
C:/Windows/System32
Requirements
- e.g. Fix crash that occurs when... Behave as Windows Explorer does. When the jar file is double clicked it uses the java env. to run and accesses the configuration files the .jar file created in the same local folder. It then opens the Launcher and the user is able to play Minecraft from this folder as they do when using Explorer.
Files Version
3.5.10.0
Windows Version
10.0.22000.2176
Log File
Thanks for the report, I've added this to the project board.
I've also had this behavior with python files when getting path. I assume this would apply to any file type that does this
Wanted to let you know there is a workaround by making a shortcut of the file and having start in target blank.
@Josh65-2201 is this the same as #12139?
Not sure since this one has issue with the path defaulting to system32 folder and that one is with the username not being correct. Could be related though.
I have found that running a file from the recent files section does give it the correct path.
I tested opening a file in VS Code and I'm having trouble reproducing this issue. The command ling args passed by Files are identical to the ones passed by File Explorer.
Still an issue with python and java files. Here's a python file that outputs the working directory getWorkingDirectory.zip
Do you have a way to test that doesn't require installing python or java?
I can't repro with a batch file
@echo off
echo Current working directory: %cd%
pause
Python and Java are the only ones I know that has the issue
I don't know if it will help much but here is my comparison of the behavior in Files vs Explorer.
https://github.com/user-attachments/assets/7ff4fac5-d094-4936-83d0-36d8c3ccbd98
A fix will be included in the next release.