English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Asm / Hardware

 
 
Thread Tools
Old 14 August 2019, 18:08   #1
8bitbubsy
Registered User
 
8bitbubsy's Avatar
 
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.
8bitbubsy is offline  
Old 14 August 2019, 18:29   #2
meynaf
son of 68k
 
meynaf's Avatar
 
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.
meynaf is online now  
Old 14 August 2019, 18:53   #3
8bitbubsy
Registered User
 
8bitbubsy's Avatar
 
Join Date: Sep 2009
Location: Norway
Posts: 1,709
Quote:
Originally Posted by meynaf View Post
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.

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)
8bitbubsy is offline  
Old 14 August 2019, 19:02   #4
meynaf
son of 68k
 
meynaf's Avatar
 
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) ?
meynaf is online now  
Old 14 August 2019, 19:17   #5
8bitbubsy
Registered User
 
8bitbubsy's Avatar
 
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.
8bitbubsy is offline  
Old 14 August 2019, 19:38   #6
ross
Defendit numerus
 
ross's Avatar
 
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.
ross is offline  
Old 14 August 2019, 20:33   #7
8bitbubsy
Registered User
 
8bitbubsy's Avatar
 
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?
8bitbubsy is offline  
Old 14 August 2019, 20:49   #8
ross
Defendit numerus
 
ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,468
Quote:
Originally Posted by 8bitbubsy View Post
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?
Posted code works in every KS.

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
ross is offline  
 


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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 13:09.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.07958 seconds with 15 queries