Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

Re^6: pp macOS external file

by IB2017 (Pilgrim)
on Apr 20, 2018 at 14:58 UTC ( [id://1213256]=note: print w/replies, xml ) Need Help??

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

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.

Replies are listed 'Best First'.
Re^7: pp macOS external file
by bliako (Abbot) on Apr 20, 2018 at 19:23 UTC

    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!

Re^7: pp macOS external file
by Anonymous Monk on Apr 20, 2018 at 21:06 UTC

Log In?

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

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (5)
As of 2024-07-15 09:06 GMT
Find Nodes?
    Voting Booth?

    No recent polls found

    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.