Jump to content
Sign in to follow this  
Tentaal

Issue with FileExists()

Recommended Posts

Tentaal

Hello,

$default_ctp="False"
$ctp_default_path=@ProgramFilesDir & "\Activision\Civilization-Call to Power"
If FileExists($ctp_default_path & "\playctp.exe") Then $default_ctp="True"

I have a problem with the FileExists() funtion.

What matters that the file playctp.exe exists, $default_ctp come always "True". What's wrong in my code???

Thanks in advance!

Share this post


Link to post
Share on other sites
xcal

I'm guessing you're somewhere later doing If $default_ctp Then etc etc. Your $default_ctp will always be true as a string. Remove the quotes.

edit - Just to be clear, I mean to remove the quotes from True and False.

Edited by xcal

Share this post


Link to post
Share on other sites
therks

You could actually change that whole chunk of code, to this:

$ctp_default_path=@ProgramFilesDir & "\Activision\Civilization-Call to Power"
$default_ctp=FileExists($ctp_default_path & "\playctp.exe")

Since FileExists returns True or False.

*Edit: Actually it returns 1 or 0, but that's almost as good.

... It probably should return True/False though...

Edited by Saunders

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×