Menu

function checkFileExists

Anonymous
2018-10-22
2018-10-22
  • Anonymous

    Anonymous - 2018-10-22

    if the file patch is empty, the function returns a bad result

    checkFileExists( '') return true
    checkFileExists( '', true) return true
    checkFileExists( '', false) return false

     
  • Stefan Zieker

    Stefan Zieker - 2018-10-22

    Hi,

    the reason for this behavior is that ScriptCommunicator combines the script path with the first argument of checkFileExists if the second argument ist empty or true.
    For example:
    Your script path is C:\folder\script.js, the first argument of checkFileExists is "" and the second argument of checkFileExists is true then ScriptCommunicator check if the path C:\folder exists. The Qt function QFileInfo::exists() returns then true.

    If the second argument in checkFileExists is false then ScriptCommunicator don't combines the script path with the first argument of checkFileExists and there for ScriptCommunicator calls QFileInfo::exists() with an empty string, which returns false.

    I'm not sure if I shall change this behavior.

    Thx for posting your observations.

     

    Last edit: Stefan Zieker 2018-10-22

Anonymous
Anonymous

Add attachments
Cancel





Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.