IsWriteable incorrect

I have a machine running Windows 10. IsWriteable for a folder item pointing to the users own Documents folder is returning False. Any location I select returns False. I know it’s writable because I can create a file there via Windows Explorer.

Any ideas what may be causing this? The same snippet of code works fine on many other machines, Windows and Mac. Just one user is having this problem.

Have you tried writing to it, even though IsWritable is returning false? If you can, then you really have a problem.

Is it a networked user? Sometimes networks give you funky permissions.

IsWritable is False, but I can write to the directory. It’s a local user. It’s very weird behavior.

Windows sometimes does things to block writes. With Xojo IDE, I could save as a binary file but not as the regular (text) format. Windows just would not let Xojo write the applicaiton out. Now if I started the Xojo app on another machine, copies it over via git and just “edited” the code, then Xojo could write out. “something” on the windows machine (either O/S, or antivirus or something) was blocking the writes that “created” the files. drove me mad.

now I never start an app on windows (even it if a windows only app), I start it on my Mac, save it in the regular text format, commit it to git, copy it to the windows machine via git then go from there.

good luck on tracking down what is giving you the false positives or weirdness you are seeing.

Do you really prefer the Windows environment for development?

Show us some code.

  //Check if db path is writable
  Dim f As New FolderItem(Preferences.dbPath, FolderItem.PathTypeNative)
  Dim intMsgResponse As Integer

  If f.IsWriteable = False Then
    intMsgResponse = MsgBox("The location (" + Preferences.dbPath + ") is not writable.  Would you like to choose a different path?", 20)
    If intMsgResponse = 6 Then
      app.selectLibraryLocation()
    End If
    Return
  End If

Preferences.dbPath on this machine is a string: “C:\Users\Public”

This has worked on hundreds of machines, this is the first time I’ve seen this false positive.

Shouldn’t you first check for f.Exists?

“C:\Users\Public” exists on the machine in question.

Is UAC on?

Yes, it’s enabled.

As a test re-try it after disabling it.

Best way to tell IF it is really writeable is just to try writing and test for the resulting error / exception rather than try “isWriteable”

but thats just my 2 cents

hate it with a passion. but the day job says I work on a windows laptop… (long story on that, we can chat about it over a beer sometime). Mac’s are 10x more developer friendly in my opinion.

Their hardware. Not necessarily their developer tools :wink:

Xcode has its way of doing things as does VS
If your familiar with one or the other you’ll feel one way or the other

I’m sure Joe R could list things he prefers in each :stuck_out_tongue:

So do Macs. I had a situation last year where the Remote Debugger could not write the tar file into the folder I wanted. All the permissions were any group could read , write or execute in the folder. Even with help from a couple of Xojo engineers we could not get to the bottom of the problem. Another folder worked fine, so I moved on.

With UAC disabled, it is still showing writable as False.

I’m going to try writing a file to the directory and see if that fails like Norman suggested. It’s a bummer this isn’t working consistently.

I agree there… I like their H/W and their O/S… and for open source development it rocks. also for Xojo development.

I am having the opposite problem. IsWriteable returns true for a text file with the Read Only attribute, which plainly should make it false.

Forum for Xojo Programming Language and IDE. Copyright © 2021 Xojo, Inc.