Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Sat May 27, 2017 9:56 pm
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: Saving files on Network volume
PostPosted: Thu Jan 24, 2013 8:42 pm 
Offline

Joined: Fri Sep 30, 2005 10:49 pm
Posts: 504
Hello,

I have two computers connected via an Ethernet Switch - "Mac Mini 183" and "Mac Mini 166"

myApp is a program I created in RS.

When I am working on myApp on "Mac Mini 183" I would like to save the document on "Mac Mini 166" in a folder named "MacMini166 Shared" in "Mac Mini 166" Public folder.

How do I do that?

Thanks.

Lennox


Top
 Profile  
 
 Post subject: Re: Saving files on Network volume
PostPosted: Thu Jan 24, 2013 10:26 pm 
Offline
User avatar

Joined: Mon Feb 05, 2007 5:21 pm
Posts: 600
Location: New York, NY
If you want your app to mount the volume, that's a different discussion. If it's already mounted, use:
dim f as FolderItem = GetFolderItem( "Public:MacMini166 Shared:", FolderItem.PathTypeAbsolute )

But hard-coding a path is a bad idea. Better to have the user select the folder once, then store the string returned from "GetSaveInfo" somewhere like a prefs file. On the next run, you can recreate the destination from that string.

If you download the MacOSLib package, there is true alias handling code and plist code within that will not only let you save an alias, but will mount the volume for you when you try to resolve it.

https://github.com/macoslib/macoslib

_________________
Kem Tekinay
MacTechnologies Consulting
http://www.mactechnologies.com/

Need to develop, test, and refine regular expressions? Try RegExRX.


Top
 Profile  
 
 Post subject: Re: Saving files on Network volume
PostPosted: Thu Jan 24, 2013 10:38 pm 
Offline

Joined: Fri Sep 30, 2005 10:49 pm
Posts: 504
Thanks Kem,
Yes, your suggestion is what I think I really wanted.
I will try it.
Lennox


Top
 Profile  
 
 Post subject: Re: Saving files on Network volume
PostPosted: Fri Jan 25, 2013 7:33 am 
Offline

Joined: Fri Sep 30, 2005 10:49 pm
Posts: 504
ktekinay wrote:
If you want your app to mount the volume, that's a different discussion. If it's already mounted, use:
dim f as FolderItem = GetFolderItem( "Public:MacMini166 Shared:", FolderItem.PathTypeAbsolute )

But hard-coding a path is a bad idea. Better to have the user select the folder once, then store the string returned from "GetSaveInfo" somewhere like a prefs file. On the next run, you can recreate the destination from that string.

If you download the MacOSLib package, there is true alias handling code and plist code within that will not only let you save an alias, but will mount the volume for you when you try to resolve it.

https://github.com/macoslib/macoslib



Hi Kem,

I already have macoslib, and I have downloaded the latest version from the above link.

Could you tell me where that 'true alias handling code and plist code" is located?

Lennox


Top
 Profile  
 
 Post subject: Re: Saving files on Network volume
PostPosted: Fri Jan 25, 2013 3:23 pm 
Offline
User avatar

Joined: Mon Feb 05, 2007 5:21 pm
Posts: 600
Location: New York, NY
In the macoslib folder, look for the FileManager module and the FSAliasRecord within. For PLists, there are a number of ways, but the easiest is to use MacPListBrowser in the Additional Modules. EXCEPT, in testing, I found there is problem when retrieving FolderItems that no longer exist, so I will be posting an update to MacOSLib later. Once I do, you can do something like this:
dim f as FolderItem = <your network volume>
dim prefs as new MacPListBrowser
prefs.Child( "save folder" ) = f
if not prefs.SaveToFile( prefFile ) then
// Do something with the error
end if

Later:
dim prefs as MacPListBrowser = MacPListBrowser.CreateFromPListFile( prefFile )
dim pSaveFolder as MacPListBrowser = prefs.Child( "save folder" )
dim f as FolderItem = pSaveFolder.VariantValue
if f is nil or not f.Exists then
dim info as string = pSaveFolder.StringValue // This will be in the update
f = FileManager.GetFolderItemFromAliasData( info, nil, FileManager.kFSResolveAliasTryFileIDFirst )
end if
if f is nil or not f.Exists then
// Something has gone wrong
end if

_________________
Kem Tekinay
MacTechnologies Consulting
http://www.mactechnologies.com/

Need to develop, test, and refine regular expressions? Try RegExRX.


Top
 Profile  
 
 Post subject: Re: Saving files on Network volume
PostPosted: Fri Jan 25, 2013 5:22 pm 
Offline

Joined: Fri Sep 30, 2005 10:49 pm
Posts: 504
ktekinay wrote:
In the macoslib folder, look for the FileManager module and the FSAliasRecord within. For PLists, there are a number of ways, but the easiest is to use MacPListBrowser in the Additional Modules. EXCEPT, in testing, I found there is problem when retrieving FolderItems that no longer exist, so I will be posting an update to MacOSLib later. Once I do, you can do something like this:
dim f as FolderItem = <your network volume>
dim prefs as new MacPListBrowser
prefs.Child( "save folder" ) = f
if not prefs.SaveToFile( prefFile ) then
// Do something with the error
end if

Later:
dim prefs as MacPListBrowser = MacPListBrowser.CreateFromPListFile( prefFile )
dim pSaveFolder as MacPListBrowser = prefs.Child( "save folder" )
dim f as FolderItem = pSaveFolder.VariantValue
if f is nil or not f.Exists then
dim info as string = pSaveFolder.StringValue // This will be in the update
f = FileManager.GetFolderItemFromAliasData( info, nil, FileManager.kFSResolveAliasTryFileIDFirst )
end if
if f is nil or not f.Exists then
// Something has gone wrong
end if



Thanks Kem,
When you post the update could you PM me.?
Thanks again.

Lennox


Top
 Profile  
 
 Post subject: Re: Saving files on Network volume
PostPosted: Fri Jan 25, 2013 11:19 pm 
Offline
User avatar

Joined: Mon Feb 05, 2007 5:21 pm
Posts: 600
Location: New York, NY
I don't know when that might be, but you can get the changes I just pushed from my repository here:

https://github.com/ktekinay/macoslib

_________________
Kem Tekinay
MacTechnologies Consulting
http://www.mactechnologies.com/

Need to develop, test, and refine regular expressions? Try RegExRX.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group