mherrmann / mherrmann/fman

Windows *.lnk shortcuts don't open

Open
#703 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug windows
Dominant language
Python
Stars
275
Forks
16
PR merge metrics
No merged PRs in 30d

Description

Hello,

I've got several shortcuts on my Desktop linking to applications (e.g. Eclipse, Notepad++, etc.) and plain folders.
When trying to open them via fman, the app or folder fails to actually open/start and fman shows an error dialog. Links to files work OK though, i.e. it would correctly open the file within the ad-hoc app.

The error I get on app and folders shortcuts:

Command 'OpenFile' raised error.

Traceback (most recent call last):
  File "fman\impl\fs_cache.py", line 36, in query
KeyError: 'stat'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\auser\AppData\Local\fman\Versions\1.6.6\Plugins\Core\core\fs\local\__init__.py", line 53, in stat
    return os.stat(os_path)
FileNotFoundError: [WinError 3] The system cannot find the path specified: 'C:\\Program Files (x86)\\Eclipse\\java-mars\\eclipse\\eclipse.exe'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "fman\impl\plugins\command_registry.py", line 128, in _execute_command
  File "C:\Users\auser\AppData\Local\fman\Versions\1.6.6\Plugins\Core\core\commands\__init__.py", line 294, in __call__
    _open_files([url], self.pane)
  File "C:\Users\auser\AppData\Local\fman\Versions\1.6.6\Plugins\Core\core\commands\__init__.py", line 327, in _open_files
    _open_local_files(local_file_paths, pane)
  File "C:\Users\auser\AppData\Local\fman\Versions\1.6.6\Plugins\Core\core\commands\__init__.py", line 331, in _open_local_files
    _open_local_files_win(paths, pane)
  File "C:\Users\auser\AppData\Local\fman\Versions\1.6.6\Plugins\Core\core\commands\__init__.py", line 355, in _open_local_files_win
    if is_dir(target_url):
  File "fman\fs.py", line 22, in is_dir
  File "fman\impl\plugins\mother_fs.py", line 62, in is_dir
  File "fman\impl\plugins\mother_fs.py", line 60, in query
  File "C:\Users\auser\AppData\Local\fman\Versions\1.6.6\Plugins\Core\core\fs\local\__init__.py", line 46, in is_dir
    return S_ISDIR(self.stat(existing_path).st_mode)
  File "fman\fs.py", line 199, in wrapper
  File "fman\impl\fs_cache.py", line 12, in query
  File "fman\impl\fs_cache.py", line 38, in query
  File "fman\fs.py", line 199, in <lambda>
  File "C:\Users\auser\AppData\Local\fman\Versions\1.6.6\Plugins\Core\core\fs\local\__init__.py", line 55, in stat
    return os.stat(os_path, follow_symlinks=False)
FileNotFoundError: [WinError 3] The system cannot find the path specified: 'C:\\Program Files (x86)\\Eclipse\\java-mars\\eclipse\\eclipse.exe'

Some info about my system:
Windows 10 Pro
Version 1903
OS build 18362.388

fman version: 1.6.6
Not registered.

FYI, I've just starting using fman to evaluate an alternative to the native MS file explorer and it does quite fantastic. This issue however would be a deal blocker for my day2day usage.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in core/commands/init.py at _open_local_files_win, then inspect core/fs/local/init.py where stat handles the shortcut target. Reproduce on Windows with .lnk shortcuts to an application and a folder, using the traceback paths as entry points. Done means both shortcut types open without the OpenFile error while file shortcuts continue to work.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
desktop, operating-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.