Posts: 4,693
Threads: 222
Joined: Apr 2022
Reputation:
322
Quote:You'd still end up with the same root issue though when you did a return$ = ClearPath(Temp$).
;-)) Not me, I prefaced what I said with this:
Code: (Select All)
' don't share temp$, temp$ is supposed to be temporary!!!
test$ = "C:\Dir1\Dir2\"
Print CleanPath$(test$)
724 855 599 923 575 468 400 206 147 564 878 823 652 556 bxor cross forever
Posts: 4,693
Threads: 222
Joined: Apr 2022
Reputation:
322
06-17-2022, 02:41 PM
(This post was last modified: 06-17-2022, 02:44 PM by bplus.)
Code: (Select All)
MyWebsite$ = "https://www.qb64phoenix.com/"
MyForums$ = "https://www.qb64phoenix.com/forums/"
Print "Show me the "; Chr$(34); "'s !? ;-))"
Print MyWebsite$ + Chr$(10) + MyForums$
OK maybe out of a text file, I can see that.
724 855 599 923 575 468 400 206 147 564 878 823 652 556 bxor cross forever
Posts: 69
Threads: 24
Joined: Apr 2022
Reputation:
2
Just to answer a few questions...
First, I don't pass Temp$ to the subroutine. The CleanPath subroutine is called from many different places in the code, passing various variables such as SourcePath$, DestinationPath$, ImagePath$, etc.
Temp$ is supposed to hold the final "cleaned" path. Since it is a global varaible, when I return from the subroutine I set my original variable to Temp$.
Example: SourcePath$ contains a full path including a filename and extension. It's possible that this path could contain a trailing backslash and / or it may be enclosed in quotes. I call the CleanPath subroutine passing SourcePath$ to it. The subroutine cleans the path and after returning from the subroutine I set to SourcePath$ to Temp$ (Temp$ holds the "cleaned" path).
Next question: How am I getting quotes in the string?
The program allows the user to provide a path by typing it in or pasting it. If a user responds to an INPUT with a path in quotes (often done if there are spaces in the path), the quotes automatically get stripped off. However, also want to allow paths that include commas (commas are valid in a path and in a filename). Since a normal INPUT won't accept a comma, I use LINE INPUT. Another effect of LINE INPUT is that it accepts the quote marks. In order to allow a user to enter a path with or without quotes, I run any path supplied through the cleanpath subroutine so that the end result is always consistent - a path without quotes and no trailing backslash.
As an example, if a user right-clicks a path in File Explorer and chooses "Copy as path", when pasted, this will include double-quote marks.
In any case, I thank you all for the suggestions - it's all working fine now. 15,000 lines of code so I still have a few more areas to test, but so far everything looks good with maybe 75% of my code tested :-).
Posts: 4,693
Threads: 222
Joined: Apr 2022
Reputation:
322
06-17-2022, 05:20 PM
(This post was last modified: 06-17-2022, 05:20 PM by bplus.)
Quote:Another effect of LINE INPUT is that it accepts the quote marks.
Oh, good to know! thanks
724 855 599 923 575 468 400 206 147 564 878 823 652 556 bxor cross forever