Skip to content

Comments

fix wrapper script to use relative path on macos#948

Merged
GyulyVGC merged 3 commits intoGyulyVGC:mainfrom
InfraWhisperer:use_relative_path_instead_of_absolute_path
Sep 20, 2025
Merged

fix wrapper script to use relative path on macos#948
GyulyVGC merged 3 commits intoGyulyVGC:mainfrom
InfraWhisperer:use_relative_path_instead_of_absolute_path

Conversation

@InfraWhisperer
Copy link
Contributor

Summary

Fixes the macOS wrapper script to use relative paths instead of absolute paths, allowing the Sniffnet app to run from any location without requiring installation in the Applications folder.

Changes

  1. Modified wrapper.sh to dynamically detect script directory using $(cd "$(dirname "$0")" && pwd)
  2. Changed from hardcoded /*/Sniffnet.app/Contents/MacOS/sniffnet to relative path resolution
  3. Used realpath to properly expand the path before passing to osascript to avoid variable expansion issues

Test plan

  1. Verified path resolution works correctly from different directories
  2. Confirmed osascript command formation is valid
  3. Tested that the script no longer depends on specific installation location

Fixes: #898

@GyulyVGC GyulyVGC added the enhancement New feature, request, or improvement label Aug 31, 2025
@GyulyVGC
Copy link
Owner

Thanks for your attempt.
However, the realpath command seems to not be installed by default on all the macOS versions.
In fact I get this error: command not found: realpath.

@InfraWhisperer
Copy link
Contributor Author

InfraWhisperer commented Aug 31, 2025

realpath

Sorry, my bad, I assumed realpath exists. I removed the usage of realpath and tested again. Please let me know if this works in your env too.

@GyulyVGC
Copy link
Owner

Nice, it now seems to work! Maybe it's worth it to use pwd -P to be sure that symbolic links are resolved.

@GyulyVGC
Copy link
Owner

It's also interesting to notice how your use of single & double quotes is finally expanding the variable, which is what I was failing to do.

I'm wondering whether we can be sure that the variable is expanded correctly in all the environments.

@GyulyVGC GyulyVGC added macOS Something related to macOS operating system packaging Application packaging labels Aug 31, 2025
@GyulyVGC GyulyVGC added this to the v1.4.2 milestone Sep 1, 2025
Copy link
Owner

@GyulyVGC GyulyVGC left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚢

@GyulyVGC GyulyVGC merged commit ae9b124 into GyulyVGC:main Sep 20, 2025
@GyulyVGC
Copy link
Owner

@all-contributors please add @InfraWhisperer for platform.

@allcontributors
Copy link
Contributor

@GyulyVGC

I've put up a pull request to add @InfraWhisperer! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature, request, or improvement macOS Something related to macOS operating system packaging Application packaging

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Wrapper script for macOS: use a relative path to the executable instead of an absolute path

2 participants