.NativePath Error

Hello guys,

          I'm carrying all my projects definitely for Cocoa, when I changed my code from [b].AbsolutePath[/b] to [b].NativePath[/b] I had problems in the two codes below, the first is a my code, the Second is a part of a [b]Listbox with Super VolumeBrowser[/b] which is already very old in my code, can anyone Help Me ?

First Code=My Code:

[code] dim f, f2, f3, f4 as folderitem
dim volumename as string

f=getfolderitem("").child(" Disp")
f2=getfolderitem("").child(“Final")
f3=SpecialFolder.library.child(“Lsrun")
f4=Volume(0)

volumename=f4.Nativepath
volumename=replaceall(volumename,":","/")

imageclon=f3.absolutepath+”ImageTemp.jpg” '<<<<<<<<<<<<<<<<<< HERE The Problem

imageclon=replaceall( imageclon,":","/")

imageclon=replaceall( imageclon,volumename,"/“)[/code]

Code 2= Listbox with Super VolumeBrowser:

  dim i as integer
  dim f69 as folderitem
  
 
  f69=getfolderitem("").child(" Disp")
  if f69 <> Nil then
    //for i=0 to VolumeCount-1
    addfolder f69.name
    RowPicture(listcount-1) = iconfolder
    cell(i,PathColumn)=f69.NativePath    '<<<<<<<<<<<<<<<<<<<<<<<<<< HERE The Problem
    
  end if

And elsewhere in the VolumeBrowser this code:

cell(row+itemsAdded,PathColumn)=f.item(i).NativePath  <<<<<<<<<< HERE The Problem

NativePath on a Mac will be the POSIX path, not the HFS path. AbsolutePath is the HFS path.

I don’t understand why you are doing
Imageclon = f3.absolutepath+“image temp.jpg”
Why not just
f3.Child(“imagetemp.jpg”)

Then use the .nativePath to display the ath o the user.

Hello Kem,

Excuse my ignorance, but from what I read all .AbsolutePath would be changed to .NativePath, is not it ??

See http://documentation.xojo.com/index.php/FolderItem.NativePath

AbsolutePath has been deprecated in favor of NativePath, but they return different formats.

replace

for i=0 to VolumeCount-1

with

for i=1 to VolumeCount-1

[quote=154496:@Axel Schneider]replace

for i=0 to VolumeCount-1

with

for i=1 to VolumeCount-1

Hello Alex,
This part of code is disabled !

You are assuming there will be a trailing slash from NativePath. But regardless

imageclon = f3.Child( "ImageTemp.jpg" ).NativePath

[quote=154501:@Kem Tekinay]You are assuming there will be a trailing slash from NativePath. But regardless

imageclon = f3.Child( "ImageTemp.jpg" ).NativePath [/quote]

Hello Kem Tekinay,
Works perfectly on my code, I want to thank the kindness that made me, it is this kind of help he gave me I’m grateful to you and to all Xojo community.

Now just do not know how to adapt the VolumeBrowser codes.

Tanks a Lot my Friend !

Anyone know if there is an updated VolumeBrowser and where I could download it ?

What I have is very old, still in RS .

You indicated where in the code the problem is appearing, but didn’t say exactly what the problem is. What’s the error or issue you’re seeing?

Kem,
Not really gives error, simply does not populate the listbox !

There’s not enough information here to figure that out. Can you post the app or an example app?

Yes do it in a few Hours

You don’t need it anymore. I changed mine over years ago to a normal ListBox.

[quote=154523:@Paulo Vargas]Anyone know if there is an updated VolumeBrowser and where I could download it ?

What I have is very old, still in RS .[/quote]

You may want to have a look at Xojo example Files/FileBrowser.xojo_binary_Project

I filled today a feedback case to ask Xojo to make a compiler warning if you use NativePath and AbsolutePath with a + operation.
Path arithmetic causes errors and bugs and should be blamed. Case 37485.

[quote=154576:@Christian Schmitz]I filled today a feedback case to ask Xojo to make a compiler warning if you use NativePath and AbsolutePath with a + operation.
Path arithmetic causes errors and bugs and should be blamed. Case 37485.[/quote]

Tanks Christian Schimitz !

I’ll take a look and try to learn something new to solve my problem.

Thank you Michel.

[quote=154576:@Christian Schmitz]I filled today a feedback case to ask Xojo to make a compiler warning if you use NativePath and AbsolutePath with a + operation.
Path arithmetic causes errors and bugs and should be blamed. Case 37485.[/quote]

Tanks Christian Schmitz