Addressing a file

Hello,

maybe a stupid question but…

How do you address as dbFile folder XXX nested inside Documents folder which sits In Apple ICloud?

Thenk you

If you mean 'something in the Documents folder (which happens to be synched using iCloud), then

 thefolder = specialfolder.documents.child("XXX")

thefile = thefolder.child("dbfilename")

But iCloud can make accessing these files problematic as they could be ‘in the cloud’ and not immediately available until redownloaded if it hasnt been used for a while.

If the file ONLY exists in iCloud, thats a bad idea but I couldn’t say how to access it.

If the file is only in iCloud you need to the Ubiquitous thingy:


if theFolderitem = Nil then Return False
if theFolderitem.Name.Left(1) = "." then Return False

try
  Dim theURL As New NSURLMBS(theFolderitem)
  
  dim value as Variant 
  dim error as NSErrorMBS
  Dim result As Boolean = theURL.getResourceValue(value, theURL.NSURLIsUbiquitousItemKey, error)
  #Pragma Unused result
  
  If error <> Nil Then
    Globals.theErrorLog.DialogErrorProceed(kErrorCloud.Replace(theFolderitem.DisplayPathMBS, "<<filename>>") + " " + error.LocalizedDescription)
    Return false
  End If
  
  'not an iCloud file
  if value = Nil then Return False
  
  'iCloud files
  if value.IntegerValue = 1 then
    
    'don't care about the trash
    if theFolderitem.Name = ".Trash" then Return False
    
    'normal file
    Return not theFolderitem.Visible
    
  elseif value.IntegerValue = 0 then
    
    'invisible files like dsstore
    Return False
    
  end if
  
catch err as NilObjectException
  Return False
end try

Thank you Beatrix, I’ll give it a try sas oon as I’m dismissed from hospital

Take care!