is there something like [ggee/getdir] but for getting the path of the currently running Pd binary?
m.
On 07/17/2013 09:44 AM, Max wrote:
is there something like [ggee/getdir] but for getting the path of the currently running Pd binary?
Seems like I saw this somewhere, but I can't remember where.
I'll add it to [pdinfo]
-Jonathan
m. _______________________________________________ Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
On 07/18/2013 02:16 PM, Jonathan Wilkes wrote:
On 07/17/2013 09:44 AM, Max wrote:
is there something like [ggee/getdir] but for getting the path of the currently running Pd binary?
Seems like I saw this somewhere, but I can't remember where.
I'll add it to [pdinfo]
Hm... there's a function pd_getdirname listed in m_pd.h, but it's a mirage because the function isn't defined anywhere.
What's the story?
-Jonathan
-Jonathan
m. _______________________________________________ Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
On 07/20/2013 11:13 AM, Jonathan Wilkes wrote:
On 07/18/2013 02:16 PM, Jonathan Wilkes wrote:
On 07/17/2013 09:44 AM, Max wrote:
is there something like [ggee/getdir] but for getting the path of the currently running Pd binary?
Seems like I saw this somewhere, but I can't remember where.
I'll add it to [pdinfo]
Hm... there's a function pd_getdirname listed in m_pd.h, but it's a mirage because the function isn't defined anywhere.
What's the story?
Ok, I figured out how to do this, but:
directory of a running executable is tricky-- I can set it up for Windows and most Linuxes but there might be a distro where it wouldn't work, or a new OS that needs yet another trick to find it. I guess this is why pd_getdirname doesn't actually get defined anywhere...
Getting the current working directory is pretty straightforward, though I don't know if that's useful.
-Jonathan
On 30/07/13 08:41, Jonathan Wilkes wrote:
Ok, I figured out how to do this
and how do you do?
y
On 07/30/2013 07:48 AM, yvan volochine wrote:
On 30/07/13 08:41, Jonathan Wilkes wrote:
Ok, I figured out how to do this
and how do you do?
In GNU/Linux on some _distros_ you can check the symlink /proc/self/exe
If you do a readink from within C in Pd you'll get the absolute path and name of the executable.
However, if you use the command "readlink" to [shell] I imagine the readlink binary will look in the mirror and give you its own name back.
I don't think /proc/self/exe is a requirement of all Linux flavors, and I don't know what the BSD OSes do, or OSX. So I'm reluctant to add this to [pdinfo].
Windows has its own function accessible from C to return the full path and name of the executable.
-Jonathan
y
On 30/07/13 20:43, Jonathan Wilkes wrote:
I don't think /proc/self/exe is a requirement of all Linux flavors, and I don't know what the BSD OSes do, or OSX. So I'm reluctant to add this to [pdinfo].
I'd say don't bother adding anything that's not really needed (which does seem the case here IMHO). especially if that's not 100% sure to be OS compatible, etc
y
there's the "shell" external - to which you can send a "pwd" message - but perhaps this only works on linux, maybe mac?.... Iain
Em Wed, 2013-07-17 às 06:44 -0700, Max escreveu:
is there something like [ggee/getdir] but for getting the path of the currently running Pd binary?
m. _______________________________________________ Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
With "shell" you could run "which pdextended", but that requires you have pdexented in your path, and it only returns the first pdextended matched.
"pwd" might not work--it might just give you the user's home directory.
On Thu, Jul 18, 2013 at 1:44 PM, Iain Mott mott@reverberant.com wrote:
there's the "shell" external - to which you can send a "pwd" message - but perhaps this only works on linux, maybe mac?.... Iain
Em Wed, 2013-07-17 às 06:44 -0700, Max escreveu:
is there something like [ggee/getdir] but for getting the path of the
currently running Pd binary?
m. _______________________________________________ Pd-list@iem.at mailing list UNSUBSCRIBE and account-management ->
http://lists.puredata.info/listinfo/pd-list
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
pwd to a [ggee/shell] results always in / (at least on OS X)
Am 18.07.2013 um 20:44 schrieb Iain Mott mott@reverberant.com:
there's the "shell" external - to which you can send a "pwd" message - but perhaps this only works on linux, maybe mac?.... Iain
Em Wed, 2013-07-17 às 06:44 -0700, Max escreveu:
is there something like [ggee/getdir] but for getting the path of the currently running Pd binary?
m. _______________________________________________ Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
On 17/07/13 15:44, Max wrote:
is there something like [ggee/getdir] but for getting the path of the currently running Pd binary?
you mind explaining why you would need that?
maybe there's an alternative way to achieve what you want?
y
Am 30.07.2013 um 13:47 schrieb yvan volochine yvan.pd@gmail.com:
On 17/07/13 15:44, Max wrote:
is there something like [ggee/getdir] but for getting the path of the currently running Pd binary?
you mind explaining why you would need that?
off cause: In an attempt to divide two processes in Pd I am currently using [pd~]. This allows for the OS to distribute the load of the sub-process on another core. That way, you can get more performance and fewer clicks depending on what you do. However, as someone has pointed here already, if the sub process stalls, you still might get drop outs eventually, since both processes are tied together with the pipe. The [pd~] approach is my favorite, as it is quite portable (exept for windows).
The alternative to it would be to run two instances and use for example netsend/netreceive and/or the incredible powerful shmem (the later I also use in the [pd~] scenario).
If you are using two separate instances, then you either need to start them manually, create a shell script that does it, or (and this is finally why I was curious to know if there is a way from within Pd to know the path of the binary) launch the second instance from he first instance through a [ggee/shell] or [moonlib/popen].
m.
On 30/07/13 15:30, Max wrote:
If you are using two separate instances, then you either need to start them manually, create a shell script that does it, or (and this is finally why I was curious to know if there is a way from within Pd to know the path of the binary) launch the second instance from he first instance through a [ggee/shell] or [moonlib/popen].
I'd definitely go for the shell script solution.. although after some quick tests I didn't manage to run 2 different pd instances from one shell script...
my 2 cents anyway
good luck! y