| Mirage Source http://www.miragesource.net/forums/ |
|
| AddLog MSE1 Fix http://www.miragesource.net/forums/viewtopic.php?f=210&t=2181 |
Page 1 of 1 |
| Author: | James [ Fri Jun 29, 2007 6:41 pm ] |
| Post subject: | AddLog MSE1 Fix |
Difficulty: 0/5 Change this: Code: Sub AddLog(ByVal Text As String, ByVal FN As String) Dim FileName As String Dim f As Long If ServerLog = True Then FileName = App.Path & "\logs\" & FN If Not FileExist(FN) Then f = FreeFile Open FileName For Output As #f Close #f End If f = FreeFile Open FileName For Append As #f Print #f, Time & ": " & Text Close #f End If End Sub To This: Code: Sub AddLog(ByVal Text As String, ByVal FN As String)
Dim FileName As String Dim f As Long If ServerLog = True Then FileName = App.Path & "\logs\" & FN If Not FileExist("logs\" & FN) Then f = FreeFile Open FileName For Output As #f Close #f End If f = FreeFile Open FileName For Append As #f Print #f, Time & ": " & Text Close #f End If End Sub |
|
| Author: | Lea [ Sun Jul 13, 2008 12:12 pm ] |
| Post subject: | Re: AddLog MSE1 Fix |
Code: Sub AddLog(ByVal Text As String, ByVal FN As String) Dim FileName As String Dim f As Integer If ServerLog = True Then FileName = App.Path & "\logs\" & FN If Not FileExist(FileName, True) Then f = FreeFile Open FileName For Output As #f Close #f End If 'f = FreeFile Open FileName For Append As #f Print #f, Time & ": " & Text Close #f End If End Sub I've changed your code a little. First, I changed "Dim f as Long" to "Dim f as Integer" because FreeFile returns an integer. Second, I changed FileExist(FN) to FileExist(Filename) thus automatically using the path we determine, instead of only the file's name in the root directory. This has not yet been applied on MSE2.3, I will let DFA know and bump for everyone else. |
|
| Author: | James [ Tue Jul 15, 2008 1:49 am ] |
| Post subject: | Re: AddLog MSE1 Fix |
Dont you need if Not FileExist(FileName, True) since you are using the whole app.path? |
|
| Author: | Lea [ Tue Jul 15, 2008 4:46 am ] |
| Post subject: | Re: AddLog MSE1 Fix |
Yup, you're correct. I'll update my code above. Thanks! |
|
| Author: | James [ Tue Jul 15, 2008 7:36 pm ] |
| Post subject: | Re: AddLog MSE1 Fix |
| Page 1 of 1 | All times are UTC |
| Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |
|