odd folderitem behaviour with dropbox

Im creating a folderitem like this :-

fn = "testruss.csv"
if not SpecialFolder.Documents.Child("HCS").Exists then SpecialFolder.Documents.Child("HCS").CreateAsFolder
if not SpecialFolder.Documents.Child("HCS").child("Exporter").Exists then SpecialFolder.Documents.Child("HCS").child("Exporter").CreateAsFolder
fn = SpecialFolder.Documents.child("HCS").child("Exporter").Child(fn).NativePath
dim f as new FolderItem(fn )

which results in a folderitem pointing to a file /Users/russ/Documents/HCS/Exporter/testruss.csv

when i examine this folderitem in the debugger, i see :-

DisplayName /Users/russ/Documents/HCS/Exporter/testRuss.csv
Name /Users/russ/Documents/HCS/Exporter/testRuss.csv
NativePath /Users/russ/Dropbox (HCS)/xojo/liveprojects/HCSExporter/:Users:russ:Documents:HCS:Exporter:testRuss.csv

what causes the native path to be inside my dropbox, when the file should be in Documents?

Don’t work on a project inside Dropbox.

well, ok :-

I copied my project folder to the desktop.
now with that code the native path is /Users/russ/Desktop/HCSExporter/:Users:russ:Documents:HCS:Exporter:testRuss.csv
so its not dropbox thats causing this.

Oh I saw dropbox and stopped reading.
Step 1 is don’t work in dropbox, you’ll run into all kinds of crazy problems doing that.

The second issue is you’re creating the folder item wrong.
SpecialFolder returns a folder item, so you don’t need to re-create one.


dim fMyItem as FolderItem = SpecialFolder.Documents.child("HCS")
if not fMyItem.exists then fMyItem.CreateAsFolder
fMyItem = fMyItem.child("Exporter")
if not fMyItem.exists then fMyItem.CreateAsFolder
fMyItem = fMyItem.child("testruss.csv")

Written in the reply editor disclaimer.

Hi Tim,
There is other code that i didnt include where I’m doing some other processing around the filename part which is why i’m getting it as a string and then using one of a few possible strings to create the folderitem.

What I still don’t understand is why, within the same folderitem, the properties point to different locations. Should they not all point to the same place?

Oh, and if i add the second parameter , folderitem.nativepath. it works correctly.

You should take a look at the FolderItem constructors.

DropBox (etc.) are really problematic, for example https://forum.xojo.com/29692-dropbox-and-folderitems-binarystreams

Yeah, it looks like some of your code used / as path delimiters and some uses colons. Don’t mix those, you’re asking for trouble.