IO Error 5. Access is denied

Trying to Remote debug to a NEW REAL PC with Windows 10 from a Mac.
The following code: (Note: previously test with VM + Win7 and Win10 without this error.)

[code]
dim fl,f as FolderItem

fl = SpecialFolder.ApplicationData.child(mAppIdentifier)
if fl = nil then
  return
end if
if fl.exists <> true then
  return
end if

#if DebugBuild then
  f = fl.child( ktest + mPathName)
#else
  f = fl.child(mPathName)
#endif
dim tos as TextOutputStream

tos = TextOutputStream.create(f)[/code]

is getting an IOException with a Error Code 5 on the last line.

As mention above this a new PC and I have done very little set up.

Help would be appreciated.

replace

if fl.exists <> true then return end if

with

if not fl.exists then fl.CreateAsFolder end if

Thanks Axel.

It’s working ok now.