14 August 2019, 18:08 | #1 |
Registered User
Join Date: Sep 2009
Location: Norway
Posts: 1,709
|
Problems with cwd when starting a program through a .info file in WB
I have a issue with a program I'm working on (ProTracker 2.3E) where it can't find the config file if it's executed from double-clicking a .info icon file, but it works just fine if you cd to the binary's directory in a shell and start it from there.
It's as if the current working directory is not set to the current open drawer in WB when you start programs through icons, how would I solve this issue? If I could somehow get the path to the current process' executable, I could change the current working directory to that... Last edited by 8bitbubsy; 14 August 2019 at 18:16. |
14 August 2019, 18:29 | #2 |
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,323
|
Initial dir is bogus when a program is run from WB.
You can use PROGDIR: assign to get the directory from which the program has been run. It is also possible it is available somewhere in the WB startup message. |
14 August 2019, 18:53 | #3 | |
Registered User
Join Date: Sep 2009
Location: Norway
Posts: 1,709
|
Quote:
I tried to add PROGDIR: in front of the filename it tries to open, and it didn't work. Also just to test, if I try to open "PROGDIR:" inside ProTracker's directory lister, it can't open that directory... I used SnoopDos, and now it says that it tries to open PROGDIR:PT-Config.00, which ought to work, but no. I'm on Workbench 3.1. Code:
MOVE.L #ConfigName2,D1 MOVE.L #1005,D2 MOVE.L DOSBase,A6 JSR LVOOpen(A6) |
|
14 August 2019, 19:02 | #4 |
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,323
|
As an alternative, have you tried calling dos.library/GetProgramDir (and then changing directory to the returned lock) ?
|
14 August 2019, 19:17 | #5 |
Registered User
Join Date: Sep 2009
Location: Norway
Posts: 1,709
|
EDIT: Ok it works now, it was my mistake. I called CurrentDir instead of SetProgramDir. Thanks!
EDIT2: Spoke too soon. Seems like SYS: is returned from GetProgramDir() when ran from an icon in WB (or that the call fails), argh! Last edited by 8bitbubsy; 14 August 2019 at 19:35. |
14 August 2019, 19:38 | #6 |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,468
|
You can use my code (removing the floppy stuff..):
http://eab.abime.net/showpost.php?p=1331387&postcount=5 Cheers. |
14 August 2019, 20:33 | #7 |
Registered User
Join Date: Sep 2009
Location: Norway
Posts: 1,709
|
Thanks for the code, but I managed to put something together myself. Apparently ProTracker is already doing something similar to your code, but it seems like it got broken in some PT2.x version by Noxious. Anyway, my method only works for kickstart 2.x and later, so I need some help - how can I easily detect if the kickstart version is V36 or above?
|
14 August 2019, 20:49 | #8 | |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,468
|
Quote:
To check for KS version: Code:
lib_Version EQU $14 KS20 EQU 36 movea.l $4.w,a6 cmpi.w #KS20,lib_Version(a6) bhs.b _ks20code ;fork |
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
P-UAE boots directly when starting the program | ipp0 | support.OtherUAE | 3 | 24 August 2011 09:31 |
Error while starting WHDLoad-file..... | Vicman | project.MAGE | 10 | 03 November 2008 13:46 |
Running non .adf file, .info file?? | ypestis | New to Emulation or Amiga scene | 5 | 29 March 2006 18:53 |
Starting a program | BippyM | Coders. Tutorials | 10 | 10 February 2006 15:35 |
|
|