File not found err msg

rfresh

Well-Known Member
Licensed User
Longtime User
My code below is giving me a file not found err msg on the File.OpenOutput line. I thought if the file didn't exist it would be created?


B4X:
Dim mFilePath As String
If File.ExternalWritable = True Then
    mFilePath = "File.DirRootExternal"
Else
    mFilePath = "File.DirInternal"
End If
Dim tw As TextWriter
tw.Initialize(File.OpenOutput(mFilePath, pDisplay_dat_filename, False))
tw.WriteLine(pNightimeIntensity)
tw.WriteLine(pAutoCloseAfterSelection)
tw.Close
 

rfresh

Well-Known Member
Licensed User
Longtime User
The problem seems to be this line:

B4X:
tw.Initialize(File.OpenOutput(mFilePath, pDisplay_dat_filename, False))

...mFilePath isn't being seen as "File.DirRootExternal" or "File.DirInternal" as previously set.
 
Upvote 0

DouglasNYoung

Active Member
Licensed User
Longtime User
rfresh,
File.DirRootExternal and File.DirInternal are constants not literal values - if you tale the quotes off it should work!

Cheers,
Douglas
 
Upvote 0

rfresh

Well-Known Member
Licensed User
Longtime User
I don't have the quotes around the variable...wait a min, you mean remove the quotes on the var assignment?
 
Upvote 0
Top