Author Topic: Unable to create the log file path  (Read 12561 times)

0 Members and 1 Guest are viewing this topic.

Offline zvit

  • Newbie
  • *
  • Join Date: May 2014
  • Posts: 7
  • Karma: 0
    • View Profile
Unable to create the log file path
« on: May 27, 2014, 01:34:13 am »
I have no issues about unicode but right before the repairs I get a warning that the repairs won't be repaired because Program is unable to create the log file path. Who cares if it can't create logs? I don't mind to do the repairs without the log! I even ran a "Take ownership" script on the log location and it's NOT read only.

Offline Shane

  • Administrator
  • Hero Member
  • *****
  • Join Date: Sep 2011
  • Posts: 9281
  • Location: USA
  • Karma: 137
  • "Knowledge should be shared not hidden."
    • View Profile
Re: Unable to create the log file path
« Reply #1 on: May 27, 2014, 11:02:38 am »
Can you post a screen shot of the actual message and what the log file path is?

The reason it says the repairs wont run (They might actually) is because in the cmd.exe scripts I have the commands set to output to the log files, so Windows is doing it at that point and I dont know if the cmd.exe will execute the command it is doing if it cant write the log. I know when the log file is in use it wouldn't do the command so I assume it wont do the command if it cant write the log as well.

The program lets you set the log file path in the settings, try changing the log path to something easier like C:\Logs :wink:

Shane

Offline zvit

  • Newbie
  • *
  • Join Date: May 2014
  • Posts: 7
  • Karma: 0
    • View Profile
Re: Unable to create the log file path
« Reply #2 on: May 27, 2014, 11:52:41 pm »
I had already tried different log paths on different drives and am getting the same result. Like I said, it actually DOES run the fixes, even after the warning, so I did all the fixes that have to do with taking ownership of drives and registry - hoping that this was causing the error message - restarted the computer and tried again but got the same error message. Attached are the shots.

p.s. yes, the computer is in Hebrew but as you see in the screen shot, the log path I set has no unicode in it. Also, even if it did, I have the "Language for non-unicode programs" set to Hebrew so that shouldn't be the issue.
« Last Edit: May 27, 2014, 11:55:06 pm by zvit »

Offline Shane

  • Administrator
  • Hero Member
  • *****
  • Join Date: Sep 2011
  • Posts: 9281
  • Location: USA
  • Karma: 137
  • "Knowledge should be shared not hidden."
    • View Profile
Re: Unable to create the log file path
« Reply #3 on: May 28, 2014, 12:56:12 pm »
The path does look fine, I take it the D:\ drive is just another local disk?

The program uses the API MakeSureDirectoryPathExists
http://msdn.microsoft.com/en-us/library/windows/desktop/ms680352%28v=vs.85%29.aspx

And the code is simple, this is the actual code

Code: [Select]
lResult = MakeSureDirectoryPathExists(sLogPath)
DoEvents
If lResult = 0 Then
    MsgBox "UNABLE TO CREATE LOG FILE LOCATION!" & vbCrLf & vbCrLf & "Repairs will fail if they can not output to the log file." & vbCrLf & "Make sure there are no Unicode chars in the path and that the program has permissions to that path.", vbCritical
End If

So for some reason MakeSureDirectoryPathExists is returning 0 (0 = False, 1 = True)

Do any logs ever end up in that folder or does it stay empty?

Shane

Offline zvit

  • Newbie
  • *
  • Join Date: May 2014
  • Posts: 7
  • Karma: 0
    • View Profile
Re: Unable to create the log file path
« Reply #4 on: May 28, 2014, 11:56:17 pm »
Yes, the code seems ok. No, it does not end up creating the log file.

It actually states:

Code: [Select]
DirPath [in]

    A valid path name. If the final component of the path is a directory, not a file name, the string must end with a backslash (\) character.

Maybe you need to add the back-slash like this?

MakeSureDirectoryPathExists(sLogPath &"\")

Just a thought.

If it were MY code (or open source) I'd add (just to test) the GetLastError function, hoping to get more info on the error. I would also debug using a breakpoint at that function and use F8 to step into it.

Anyway, thanks for the reply!


Offline Shane

  • Administrator
  • Hero Member
  • *****
  • Join Date: Sep 2011
  • Posts: 9281
  • Location: USA
  • Karma: 137
  • "Knowledge should be shared not hidden."
    • View Profile
Re: Unable to create the log file path
« Reply #5 on: May 29, 2014, 09:10:26 am »
Quote
Maybe you need to add the back-slash like this?

MakeSureDirectoryPathExists(sLogPath &"\")

Nope, because the \ is already there, I have the program add it to the path when you apply it, look at your screen shot and you will see it is already there :wink:

Quote
If it were MY code (or open source) I'd add (just to test) the GetLastError function, hoping to get more info on the error. I would also debug using a breakpoint at that function and use F8 to step into it.

I will have to add the getlasterror function to it, I already have the api in the program for the file copy api so will be easy to apply it there. I am curious to what error it will give on why it cant access that folder.

What happens if you changed the log folder to the C:\ drive instead? Does it still give the error?

You also didnt answer my question on D:\, is it just another hard drive or is it a mapped drive or thumb drive or something like that?

Shane