Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^5: pp macOS external file

by marto (Cardinal)
on Apr 20, 2018 at 14:26 UTC ( [id://1213255]=note: print w/replies, xml ) Need Help??


in reply to Re^4: pp macOS external file
in thread pp macOS external file

Are you sure this is the solution you are looking for? If I move this exe into a different location from all the source (the perl and png file) I get:

marto@Shemp:~/perlmonks$ ./test2 Cannot open '/home/marto/perlmonks/myicon.png' in mode 'r' at Tk/Image +.pm line 21

Replies are listed 'Best First'.
Re^6: pp macOS external file
by IB2017 (Pilgrim) on Apr 20, 2018 at 14:58 UTC

    I understand what you mean. However, the problem I am facing has a more general character: in the version created with pp I have the problem to "link" any sort of file to my executable (for example a SQLite database the app creates the first time it is run). This fails because of the issue with the path. I actually would like the executable to behave like my Terminal script in terms of paths. Just a side note: on Windows I do not have this issue.

      Maybe you should have a configuration file in user's home dir pointing to all your resources, read-only, like icons but also re-writable like the SQLlite file! This solves also the problem of when you want to preserve the contents of the database for the next run. An installer of some sort (can just be a shell script) will also allow you taking care of different users.

      Alternatively, create a shell script which will call your perl pp file from within a certain folder which you will know that program resources (ro/rw) are located. You achieve this via a "cd" (change dir) first. Call that script instead of the pp executable from anywhere you like, it will first cd to proper dir. Firefox for example does this: 1) install resources to user dir, 2) install firefox binary and libs in system bindir, 3) create a shell script (mine is /usr/bin/firefox) which finds resources, checks things and then it calls the real firefox binary. However, that "cd" I do not like.

      p.s. for joining filenames and paths in different OS, I use the portable File::Spec->catfile.

      p.s. 2 in windows I often found that two bugs combined together could result in correct program flow!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1213255]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (7)
As of 2024-04-23 13:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found