Jump to content

Recommended Posts

Posted

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!

Posted (edited)

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
Posted (edited)

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

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
×
×
  • Create New...