Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 03:57 24 Nov 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : have we discused relitive file paths befor?

Author Message
mclout999
Guru

Joined: 05/07/2020
Location: United States
Posts: 469
Posted: 02:59am 22 Oct 2024
Copy link to clipboard 
Print this post

When I get a program here it will only run if it is in the same location as the programmer had it.  I was wondering if there is any way to make a BAS file load files first from its own directory.  If the programmer has to hardcode paths it really is tedious to have to save the files on the same drive or edit the file to hardcode the paths. I guess I am just used to dos that would assume the file and sub directories relative to the program starting folder. It tend to make for a mess of the folder structures or forces me to put programs on a limited Flash drive a:  Maybe this was covered before I can't remember or find it here in search. Sorry if this is all well-known.
 
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 2135
Posted: 04:13am 22 Oct 2024
Copy link to clipboard 
Print this post

What platform? For the Pico:-
  Quote   ? MM.INFO(PATH) Returns the path of the current program or NONE if called after a NEW or EDIT Command


Then you could try ./file for the current directory and ../file for the one above as they are relative to that.
eg LIST "./file.txt"
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6094
Posted: 06:05am 22 Oct 2024
Copy link to clipboard 
Print this post

I am having the most success by recording the path to the program on startup with
dim progFolder$ = mm.info$(path)


I then use that to convert relative paths to full paths as required.

Jim
VK7JH
MMedit   MMBasic Help
 
mclout999
Guru

Joined: 05/07/2020
Location: United States
Posts: 469
Posted: 02:01pm 22 Oct 2024
Copy link to clipboard 
Print this post

Thank you both for the info and I will try to figure it out but where can I get the manual that covers all the stuff I have been seeing on the forum for the PICO HDMIUSB I am using?  Is there a mostly complete Manual besides the one on geoffg.net? That one is about the VGA variant.
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6772
Posted: 02:39pm 22 Oct 2024
Copy link to clipboard 
Print this post

There hasn't been a manual for a while. :)  The HDMI and USB stuff wasn't available at that time.

I did this not long ago and I've just added a bit that I missed (HDMI pins) and brought it up to date, I think.

MMBasic catchup - 22-10-24.pdf
Edited 2024-10-23 00:40 by Mixtel90
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
mclout999
Guru

Joined: 05/07/2020
Location: United States
Posts: 469
Posted: 05:39pm 22 Oct 2024
Copy link to clipboard 
Print this post

  Mixtel90 said  There hasn't been a manual for a while. :)  The HDMI and USB stuff wasn't available at that time.

I did this not long ago and I've just added a bit that I missed (HDMI pins) and brought it up to date, I think.

MMBasic catchup - 22-10-24.pdf


I found an older version of this one so this is nice to see.  It goes up to B4 and we are now on RC9 I hope not much has changed from your document.  Thanks.
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6772
Posted: 08:21pm 22 Oct 2024
Copy link to clipboard 
Print this post

This one goes up to RC8. RC9 is bug fixes. Nothing to add, really.

Obviously, it starts more or less where the current manual(s) end so you need at least one of those as well. There isn't one manual that covers all versions now, it was getting too big to manage.
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024