File functions don't work when I used the "debug on history data" mode

 
if(!FileIsExist(appName))
      {
         bool isCreated = FolderCreate(appName);
         if(!isCreated)
         {
            Print("Error! The folder was not created");
         }
      }

When I run my EA on real data, a folder is created. When I run the EA with same code on the "debug on history data" mode, the folder isn't created, but the isCreated variable sets to true as if folder had been created.

How to fix it ? I need to create files for analysis...

Reason: