Jump to content

Need to modify this: (setq FullFile (cons (strcat Path "\\" File) FullFile))


Recommended Posts

Posted

Hi there,

 

In a piece of code wich I have is this line:

 
(setq FullFile (cons (strcat Path "\\" File) FullFile))

 

In the end it returns:

 
"c:\program file\marcow\\test.lsp"

 

This is obviously not good because the double

"\"

before

"test.lsp"

should be a single one.

 

Now, if I delete this part "\\" it doesn't work, like this:

 

 
(setq FullFile (cons (strcat Path File) FullFile))

 

Because I am in a learning process I only want to know if I need to search elsewhere to modify my code...

 

I found out that when I modify this:

>options>tab files>support file search paths>marcow\

into

>options>tab files>support file search paths>marcow

 

I do not need to modify the code at all, but since all my support file search paths end wit one "\" i figure I need to keep it that way....

 

This is bugging me now for sometime but I have no clue, please gimme a hint :)

Posted (edited)

try something like this

 
(setq test (strcat (getvar 'roamablerootprefix) "Support\\" "test.lsp"))

 

another test...

 

 
(getfiled "Test" "" "lsp" 

 

notice how both come back with double backslashes

Edited by Lt Dan's legs
Posted

LT Dan's Legs: thanks for the reply.

 

Unfortunately I do not see what you mean.

I noticed them coming up with double backslashes.

 

This is my problem:

"C:\program files\marcow\user\\marcow_linetypes.lin": Invalid file name.

 

Should it be all double backslashes?

Posted

Yes they should. Forgive me, I'm known for being unclear. Something I'm working on :oops:

 

does this work for you?

 

 
(setq fullfile (findfile file))

 

assuming this file is in the support path

Posted
Should it be all double backslashes?

 

Yes. AutoCAD requires double-backslashes from LISP...

 

For example:

 

"C:\\program files\\marcow\\user\\marcow_linetypes.lin" 

 

 

*Unless* you were to use single forward-slashes.

 

For example:

 

Command: (findfile "C:/program files/marcow/user/marcow_linetypes.lin")
"C:\\program files\\marcow\\user\\marcow_linetypes.lin" 

 

 

However, it is common practice to use double back-slashes.

Posted

Hello everybody,

 

I have been searching why it always had worked in previous version of my programs and not anymore.

In the end I found that my current support file search paths in options>files>support file search path> all end with a backslash.

My previous program had them with no backslash in the end.

 

I simply removed the backslashes of all of them and there seems to be no more problem.

The problem is / was the 3rd backslash.

I encounter no further problems due to missing backslashes so I think it is allright now.

 

Thanks for all the help provided!

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...