The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
 All Forums
 Origin Forum for Programming
 LabTalk Forum
 Path error, possible conflict with symbols

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
Clairekun Posted - 08/05/2020 : 4:42:49 PM
Origin Ver. and Service Release (Select Help-->About Origin): 2018b
Operating System: Windows 10

Hello,

I am trying to import files from a certain path and I am encountering the error "Invalid file path!", even if the path is correct.

To try to check where the error is found, I typed:
string strPath$ = "D:\Samples\";
path$= strPath$;
findFolders; 
int n = folder.GetNumTokens(CRLF);	
type "$(n) subfolders found";
type path$;
string TempFol$ = folder.GetToken(1, CRLF)$;
path$ = strPath$ + "\" + TempFol$;	
findFolders; 	
int nn = folder.GetNumTokens(CRLF); 	
type "$(nn) subfolders found";
type path$;
TempFol$ =;
string dscFol$ = folder.GetToken(1, CRLF)$;
path$ = strPath$ + "\" + TempFol$ + "\" + dscFol$; 
findFolders;
int nnn = folder.GetNumTokens(CRLF);
type "$(nnn) subfolders found";
type path$;
dscFol$ =;
string ZnFol$ = folder.GetToken(1, CRLF)$; 
path$ = strPath$ + "\" + TempFol$ + "\" + dscFol$ + "\" + ZnFol$ + "\Data\New";
findFolders;
int nnnn = folder.GetNumTokens(CRLF);
type "$(nnnn) subfolders found";
type path$;
ZnFol$ = ;


And it returned:

3 subfolders found
D:\Samples
4 subfolders found
D:\Samples\3000°C
3000°C
4 subfolders found
D:\Samples\3000°C\DSC1
DSC1
0 subfolders found
D:\Samples\3000°C\DSC1 ---This is incomplete; should be D:\Samples\3000°C\DSC1\0.50%\Data\New
0.50% ---This is correct


While it retrieves all folder names correctly (even the last one), it won't get the whole path from the last folder. I suspect it has something to do either with "." or with "%", but the workarounds I tried did not work.

Is there any way I can get the correct path for folders that include these symbols?

Thank you.
3   L A T E S T    R E P L I E S    (Newest First)
Clairekun Posted - 08/07/2020 : 09:31:03 AM
Thank you, although I could finally solve it myself. In my original code, every GetToken string was inside a for {} command, so there was a loop for every subfolder.

There was some conflict identifying which path was called everytime; what I did was assign each path to a differently named string, and the problem vanished. I was lazy and didn't want to name every single thing, but in the end it makes everything clearer.
Castiel Posted - 08/07/2020 : 02:25:46 AM
quote:
Originally posted by Clairekun

Hello,

I dug a bit further and I discovered it has nothing to do with symbols or path length.

I tried setting the first path to inner subdirectories and execute less lines.

a. If the initial path is D:\Samples\3000°C\DSC1\, and I run the code up to TempFol$ =; , the text returned is correct:
4 subfolders found
D:\Samples\3000°C\DSC1
DSC1
0 subfolders found
D:\Samples\3000°C\DSC1\0.50%
0.50%


b. If I take the initial path 1 step backwards, that is, D:\Samples\3000°C\, and try to run the code up to dscFol$ =; , I get the same result as my first post:
4 subfolders found
D:\Samples\3000°C
3000°C
4 subfolders found
D:\Samples\3000°C\DSC1
DSC1
0 subfolders found
D:\Samples\3000°C\DSC1 ---This is incomplete; should be D:\Samples\3000°C\DSC1\0.50%
0.50% ---This is correct


I thought maybe there was a maximum of strings you could concatenate in a path, but I have used 3 appended strings before with no problem whatsoever.

On the other hand:
c. If I set the initial path to D:\Samples\3000°C\DSC1\0.50%\, and simply write:
string strPath$ = "D:\Samples\3000°C\DSC1\0.50%\";
path$= strPath$;
type path$;


D:\Samples\3000°C\DSC1 ---This is incomplete; should be D:\Samples\3000°C\DSC1\0.50%


Is there anything obvious I'm missing here? Why is it not working?



type -v path$



------------------------------------------
       Be The Change
             You Want To See
                   In The World
------------------------------------------
Clairekun Posted - 08/06/2020 : 7:19:23 PM
Hello,

I dug a bit further and I discovered it has nothing to do with symbols or path length.

I tried setting the first path to inner subdirectories and execute less lines.

a. If the initial path is D:\Samples\3000°C\DSC1\, and I run the code up to TempFol$ =; , the text returned is correct:
4 subfolders found
D:\Samples\3000°C\DSC1
DSC1
0 subfolders found
D:\Samples\3000°C\DSC1\0.50%
0.50%


b. If I take the initial path 1 step backwards, that is, D:\Samples\3000°C\, and try to run the code up to dscFol$ =; , I get the same result as my first post:
4 subfolders found
D:\Samples\3000°C
3000°C
4 subfolders found
D:\Samples\3000°C\DSC1
DSC1
0 subfolders found
D:\Samples\3000°C\DSC1 ---This is incomplete; should be D:\Samples\3000°C\DSC1\0.50%
0.50% ---This is correct


I thought maybe there was a maximum of strings you could concatenate in a path, but I have used 3 appended strings before with no problem whatsoever.

On the other hand:
c. If I set the initial path to D:\Samples\3000°C\DSC1\0.50%\, and simply write:
string strPath$ = "D:\Samples\3000°C\DSC1\0.50%\";
path$= strPath$;
type path$;


D:\Samples\3000°C\DSC1 ---This is incomplete; should be D:\Samples\3000°C\DSC1\0.50%


Is there anything obvious I'm missing here? Why is it not working?

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000