cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
CodeMonkey
Level 2

FILE_EXISTS trouble

Hi,

I am having a problem with the 'Is' function within my install-script. I can not recognise the existence of a file which clearly exists on my disk. The reason for this is the space character within the specified path. If I rename the "My Stuff" directory "MyStuff", the 'Is' function call works as expected.

if (Is(FILE_EXISTS, "C:\My Stuff\MyFile.txt") == TRUE) then
doMyStuff();
end;

Can someone please tell me how to escape the space character? (My attempts to do so thus far have been unsuccessful) Thanks.
Labels (1)
0 Kudos
3 Replies
skolte
Level 7

If you have a text file such as 'C:\My Test\test Copy.txt', this code should work:


if (Is(FILE_EXISTS, "C:\\My Test\\test Copy.txt")) then
MessageBox("File Exists", 0);
endif;


The problems with your code were:

  • there was no escape sequence for '\',
  • '==' instead of '=' .. In fact you don't need it.
  • end; instead of endif;
0 Kudos
CodeMonkey
Level 2

Thanks for your input. I am out of the office at present and entered a code snippet from 'memory' to describe the problem in simple terms. I think my actual code does not have all the flaws identified in this snippet, although it does exhibit some.

I will follow your suggestions tomorrow and hope for success.
0 Kudos
skolte
Level 7

🙂 .. Ok, I should have guessed that...Anyway, just for fun, I tried my code in a new sample, it works, so you should be able to use it as it is.
0 Kudos