12 January 2023, 01:14 | #1 |
Registered User
Join Date: Dec 2012
Location: Vancouver/Canada
Posts: 678
|
How to separate path and file name from FileNameRequest$
Hello,
I have a command called FileRequest$ it returns both path and filename as one long string. I could have something like this: Work: Download/Adf/Filename.txt or Work: Download/ADF/ <-- missing Filename.txt or Work: Filename.txt or Work: <-- missing Filename.txt How do I separate Filename.txt from the path and put each in their separate string holder? Thanks in advance. |
12 January 2023, 01:59 | #2 |
Registered User
Join Date: Mar 2010
Location: Beckenham/England
Posts: 799
|
Pathpart and filepart:
https://aminet.net/package/util/cli/0Utils or https://aminet.net/package/util/batch/MoreCLI1.2 One set didn't work for me, think it was the ones from MoreCLI, but can't remember for sure... |
12 January 2023, 04:16 | #3 |
Registered User
Join Date: Dec 2012
Location: Vancouver/Canada
Posts: 678
|
Erm...no...I am asking for blitzbasic source code not a third party application utilities.
|
12 January 2023, 13:11 | #4 |
Registered User
Join Date: Nov 2019
Location: Celle / Germany
Posts: 147
|
The Mid$()-function is your friend.
You can parse the string for yourself from right to left and Split the string. |
12 January 2023, 13:40 | #5 |
Ex nihilo nihil
Join Date: Oct 2017
Location: CH
Posts: 5,070
|
Long time not touched Blitz but if there is no in-box function for that I think the best is :
1) find the ":" (you get the drive name before) 2) find the last "/" (you get the filename after) 3) everything in between is the path. |
12 January 2023, 13:45 | #6 |
Registered User
Join Date: Nov 2019
Location: Celle / Germany
Posts: 147
|
Asking for source, there is of course the include "DOS.include.ab3" that contains proper functions in AmiBlitz3.
|
17 January 2023, 17:36 | #7 |
Registered User
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,381
|
For completeness (I answered this elsewhere), there are also the FilePart$() and PathPart$() functions in one of the standard 3rd party libraries (ElmoreDOSLib IIRC). It's likely they just call the dos.library functions anyway, but in a Blitz-friendly way.
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
set script path as relative path | Tolgod | Coders. Scripting | 3 | 05 November 2021 13:08 |
Include file path priorities for assemblers | phx | Coders. General | 20 | 07 July 2020 16:30 |
Picasso iV ROM file path | PeterK | support.WinUAE | 11 | 01 April 2018 02:00 |
Use file requester to specify path in Shell? | Foebane | support.Apps | 5 | 01 January 2017 15:32 |
Separate PPC | mritter0 | support.WinUAE | 8 | 18 September 2014 00:56 |
|
|