Help - Search - Members - Calendar
Full Version: how to get foobar2000's current working directory
Hydrogenaudio Forums > Hosted Forums > foobar2000 > Support - (fb2k)
Luis E Alvarado
Ok, first off, first post but big time user of this forum, due to that I only post when necessary and only give credit where needed.

Moving on, here is a feat. I am trying to move foobar from my program files folder to a portable storage device, e.g. usb drive, thumb drive, etc.

I had the user_profiles_enabled and all I did was to copy the contents of
CODE
%APPDATA%\foobar2000
to my foobar2000 directory and delete user_profiles_enabled. This worked fine, and of course I backed up my
CODE
%APPDATA%\foobar2000
directory before my config was ruined.

Now for the second step, I have Album Art and Lyrics panel enabled on my current columns UI setup (see attachment), and it looks neat when it works properly...
Anyways, now I have to set up my run services and I need to find out the path where foobar2000 is running from. I already know that you can use
CODE
@for %%e in (%PATHEXT%) do @for %%i in (%1%%e) do @if NOT "%%~$PATH:i"=="" echo %%~$PATH:i
for batch files and
CODE
getdcwd()
funtion for many win32 programs.
Now my issue is, does foobar2000 support this( I tried too, but no outcome), and if not, is there a workaround. I was thinking of setting up a batch file that would run the above script(let's assume I am running foobar2000 from a usb drive), update the config file(in my case, the run services plugin: foo_run) and you would have the updated dir no matter if: the usb drive is moved to a different pc and that pc assigns a different drive letter to that drive, the user changes the drive letter himself, etc.
Which brings me to this question;
foobar2000.cfg contains these values, what is the best or safest way for my script to modify this file without breaking important foobar2000 specific settings. All I need my batch file is to rename all instances of
CODE
"C:\Program Files\foobar2000\"
and after the first run:
CODE
"<USB Drive Letter>\<app subforder>\foobar2000\"
to keep it updated.

Sound complicated, but it is not, if foobar2000 supports an internal way of finding its current directory, let me know, that will save me the whole batch file issue.
If it doesn't, I believe this will come in handy for people that like to take applications on the run, since this will allow you to run foobar2000 from any computer that you hook up to, with small to no effort at all...

Please let me know if you have a better idea, maybe this can scale up to a plug in to make it a lot easier or the new user side.

I'll be watching this topic, all comments are welcomed and respect your senior hydrogenaudio members, no matter the post count(same applies for me!).
/attachment: Foobar2000_ColumsUI_01.jpg
Squeller
I'm not sure about your problem, but I don't see a problem here. AFAICS you do not need the "for" stuff any more. What I do, is start my portable apps like this. The batches are at root level. This is the directory structure:

\
\start_softwareXY.cmd
\softwareXY\
\softwareXY\softwareXY.exe

The batch file start_softwareXY.cmd has this:

CODE
start /b "" "%~dp0softwareXY\softwareXY.exe"


%~dp0 -> Drive and path of the calling batch file. So your fb2k directly can always be found relative to it. See (google) windows chm help on cmd.exe/variables, may be a very good help.
Luis E Alvarado
Man, thanks a lot for the reply.
I see what you mean, the batch file will always be able to find the foobar installation due to it's level and permanent name. Same goes for foobar by using the %~dp0 cmd variable.
Thanks a lot for the info. I'll give this a shot and report back as soon as I get some results!
Thanks!
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.