[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl-Toolbox] Determining a full path to the current folder



Greetings!

I want to determine the full path to the folder in which a MacPerl 
application resides, and has just been launched.

The only bullet-proof way I've figured out of doing this is as follows:

---
use Mac::Processes;

$processID = GetCurrentProcess();
$appPath = $Process{$processID}->processAppSpec();
$appNameLength = length $Process{$processID}->processName();
$folderPath = substr($appPath,0,(-1 * $appNameLength));
---

Am I missing something, or is there a more direct way?

Henry.


PS: The reason I don't use $Application{'blah'} is because it can get 
confused by multiple applications with the same creator code, and hence 
requires lots of extra contingency code.

PPS: If run as a normal script, the above code will locate the path to 
the copy of MacPerl which is executing that script, not the location of 
the script itself (obviously).

==== Want to unsubscribe from this list?
==== Send mail with body "unsubscribe" to macperl-toolbox-request@macperl.org