I'm working on an app that has several sections and activities. All of the completed sections are working without error. Therefore, today I began a new section.
In the development phase I'm using a variable to be written to a simple file to keep track of which day of the app's "purpose" is currently being processed. The variable is "NDay."
As a beginning for the section being worked on, I have inserted the following code as an initial test
If File.Exists(File.DirAssets, "nset.txt") Then
NDay = 0
File.WriteString(File.DirAssets, "nset.txt", "0")
NDay = -1
Log("NDay = " & NDay)
NDay = File.ReadString(File.DirAssets, "nset.txt")
Log("NDay = " & NDay)
Else
Log("File and/or Dir does not exist.")
Activity.Finish
End If
The bolded line gives me a "File not found exception error." However, the file does exist as does the directory (which contains all the other files to be used thus far). When I comment out the offending line, everything works fine as it should. Whether the line is marked or unmarked as a comment makes no difference, the "Else" clause never gets executed. I should note this code is executed in a "Sub InitMain" that is called in Sub Activity_Create immediately after the Layout file is loaded.
What is the cause? Thanks.
In the development phase I'm using a variable to be written to a simple file to keep track of which day of the app's "purpose" is currently being processed. The variable is "NDay."
As a beginning for the section being worked on, I have inserted the following code as an initial test
If File.Exists(File.DirAssets, "nset.txt") Then
NDay = 0
File.WriteString(File.DirAssets, "nset.txt", "0")
NDay = -1
Log("NDay = " & NDay)
NDay = File.ReadString(File.DirAssets, "nset.txt")
Log("NDay = " & NDay)
Else
Log("File and/or Dir does not exist.")
Activity.Finish
End If
The bolded line gives me a "File not found exception error." However, the file does exist as does the directory (which contains all the other files to be used thus far). When I comment out the offending line, everything works fine as it should. Whether the line is marked or unmarked as a comment makes no difference, the "Else" clause never gets executed. I should note this code is executed in a "Sub InitMain" that is called in Sub Activity_Create immediately after the Layout file is loaded.
What is the cause? Thanks.
Last edited: