I am creating dynamic config file through exe.My application was connecting to database every thing working fine.But i need to check the config file is exists or not. I need to develop some logic depends on that config file i need to check every time while exe is starting.
How can i find the config file is exists,How to find the config path in exe.?
Something like this
$exe_file = exo_getglobalvariable("HEPublicationFile", "0");
$config_path_parts = explode("\\",$exe_file);
$config_file_last = count($config_paht_parts)-1;
$config_path_parts[$config_file_last] = "config.ini";
$config_file = implode("\\",$config_path_parts);
or if you know exe file name
$config_file = str_replace("\\my_app.exe","\\config.ini");
Is it not easier if you do it like this:
$myPath = exo_getglobalvariable('HEPubStorageLocation', '');
$configPath = '/CONFIG/config.ini') // CONFIG is a Subfolder
$configFile = $myPath.$configPath;
/*
e.g.:
yourexe.exe
|- CONFIG DIR
|-- config.ini
*/
if(file_exists($configFile) {
echo "CONFIG IS HERE!";
} else {
echo "NO CONFIG FILE FOUND!";
}
?
HEPubStorageLocation is not equal to where is exe file.