Cross Platform Preference File (REALbasic getting started Mailinglist archive)

Back to the thread list
Previous thread: Documentation Errors/The RB "Neverending Story"
Next thread: Re: Mysterious Window Appearance & SQL error


RB Database   -   tom.russell transport.alstom.com
  Cross Platform Preference File   -   Jay Rimalrick
   Re: Cross Platform Preference File   -   Brad Rhine
   Re: Cross Platform Preference File   -   Charles Yeomans
   Re: Cross Platform Preference File   -   Lars Jensen
    Re: Cross Platform Preference File   -   Jay Rimalrick
     Re: Cross Platform Preference File   -   Jonathan Johnson
     Re: Cross Platform Preference File   -   Ian Mann
   Re: Cross Platform Preference File   -   Lars Jensen
    Re: Cross Platform Preference File   -   Jonathan Johnson

Cross Platform Preference File
Date: 29.05.04 04:07 (Fri, 28 May 2004 23:07:08 -0400)
From: Jay Rimalrick
What is the easiest was to create a preference file for a cross platform program? Is there a simple way to have it work on all platforms or do I need to do a separate exception for each platform?

Thanks,
Jay



________________________________________________________________
Sent via the WebMail system at 1st.net



_______________________________________________
Unsubscribe or switch delivery mode:
<http://support.realsoftware.com/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Re: Cross Platform Preference File
Date: 29.05.04 14:19 (Sat, 29 May 2004 09:19:42 -0400)
From: Brad Rhine
On May 28, 2004, at 11:07 PM, Jay Rimalrick wrote:

> What is the easiest was to create a preference file for a cross
> platform program? Is there a simple way to have it work on all
> platforms or do I need to do a separate exception for each platform?

Define your own format and it will work on all platforms. XML is a good
choice.

Re: Cross Platform Preference File
Date: 29.05.04 16:38 (Sat, 29 May 2004 11:38:57 -0400)
From: Charles Yeomans

On May 28, 2004, at 11:07 PM, Jay Rimalrick wrote:

> What is the easiest was to create a preference file for a cross
> platform program? Is there a simple way to have it work on all
> platforms or do I need to do a separate exception for each platform?
>

I wrote an article on this for a recent issue of REALbasic Developer
magazine. You could order the issue from
<http://www.rbdeveloper.com/>.

--------------
Charles Yeomans

_______________________________________________
Unsubscribe or switch delivery mode:
<http://support.realsoftware.com/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Re: Cross Platform Preference File
Date: 29.05.04 15:31 (Sat, 29 May 2004 10:31:06 -0400)
From: Lars Jensen
> What is the easiest was to create a preference file for a cross platform
> program? Is there a simple way to have it work on all platforms or do I need
> to do a separate exception for each platform?

Make it a text file, and use ReadLine to read it in. See
http://ljensen.com/utool for an example.

lj

_______________________________________________
Unsubscribe or switch delivery mode:
<http://support.realsoftware.com/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Re: Cross Platform Preference File
Date: 30.05.04 04:15 (Sat, 29 May 2004 23:15:52 -0400)
From: Jay Rimalrick
I'm sorry I was not more clear, my question about a cross platform preference
file was more concerned with the file path. I'm not sure if I am going to make
an installer for my program, if I was i would simply put it in the folder that my
program was created in. However, if I let the user drag the program where
they like, they may put it on their desktop and then the preference file would
be on the desktop.

I know the mac keeps preference files in the preferences folder. However I
don't really know where windows standardly keeps their preference files. I
don't think there is a place. I was just wondering if realbasic offered a simply
way to write preference files in a standard place despite the platform.

Thanks for any input,
Jay



________________________________________________________________
Sent via the WebMail system at 1st.net



_______________________________________________
Unsubscribe or switch delivery mode:
<http://support.realsoftware.com/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Re: Cross Platform Preference File
Date: 30.05.04 04:17 (Sat, 29 May 2004 22:17:36 -0500)
From: Jonathan Johnson

On May 29, 2004, at 10:15 PM, Jay Rimalrick wrote:

> I'm sorry I was not more clear, my question about a cross platform
> preference
> file was more concerned with the file path. I'm not sure if I am
> going to make
> an installer for my program, if I was i would simply put it in the
> folder that my
> program was created in. However, if I let the user drag the program
> where
> they like, they may put it on their desktop and then the preference
> file would
> be on the desktop.
>
> I know the mac keeps preference files in the preferences folder.
> However I
> don't really know where windows standardly keeps their preference
> files. I
> don't think there is a place. I was just wondering if realbasic
> offered a simply
> way to write preference files in a standard place despite the platform.

Take a look at the "PreferencesFolder" function. On Linux, prepend a
"." to the beginning of the name as well, since the Preferences Folder
is the user's home directory, and that's just "The Way It Is™"

HTH,
Jon

Re: Cross Platform Preference File
Date: 30.05.04 07:59 (Sun, 30 May 2004 07:59:13 +0100)
From: Ian Mann

On Sunday, May 30, 2004, at 04:15 am, Jay Rimalrick wrote:

> I'm sorry I was not more clear, my question about a cross platform
> preference
> file was more concerned with the file path. I'm not sure if I am
> going to make
> an installer for my program, if I was i would simply put it in the
> folder that my
> program was created in. However, if I let the user drag the program
> where
> they like, they may put it on their desktop and then the preference
> file would
> be on the desktop.
>
> I know the mac keeps preference files in the preferences folder.
> However I
> don't really know where windows standardly keeps their preference
> files. I
> don't think there is a place. I was just wondering if realbasic
> offered a simply
> way to write preference files in a standard place despite the platform.
>
> Thanks for any input,
> Jay
>

You may not want to ship with a preference file : You could :

set up all your prefences as properties in your app.

On start up look for the preferences file in your app : (In the App
open event)

dim f as folderItem
dim t as textInputStream
dim a as String
f 1referencesFolder.child(PrefFileName)
if f <> nil then
if f.exists then
t O.openAsTextFile
if t <> nil then
'Read Prefs here ( UserName 1.readLine) etc
else
defaultPrefs
end if
else
defaultPrefs
end if
else
defaultPrefs
end if

So if you cant find/read the prefs file you set them to defaults.

UserName sArchibald P Finkelstein"

The in your app close event you can have

dim f as folderItem
dim t as textoutputStream
f 6referencesFolder.child(PrefFileName)
if f <> nil then
t O.createtextFile
if t <> nil then
etc (t.writeLine UserName)

plus all associated end ifs.

You basically need three methods :

ReadPrefs (Open)
DefaultPrefs (If read prefs doesn't work)
WritePrefs (Close)

Good Luck and Best Regards

Ian

_______________________________________________
Unsubscribe or switch delivery mode:
<http://support.realsoftware.com/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Re: Cross Platform Preference File
Date: 30.05.04 05:26 (Sun, 30 May 2004 00:26:27 -0400)
From: Lars Jensen
> Take a look at the "PreferencesFolder" function. On Linux, prepend a
> "." to the beginning of the name as well, since the Preferences Folder
> is the user's home directory, and that's just "The Way It Is."

Prepend a "." to the name of the preference file?

lj

_______________________________________________
Unsubscribe or switch delivery mode:
<http://support.realsoftware.com/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Re: Cross Platform Preference File
Date: 30.05.04 13:02 (Sun, 30 May 2004 07:02:37 -0500)
From: Jonathan Johnson

On May 29, 2004, at 11:26 PM, Lars Jensen wrote:

>> Take a look at the "PreferencesFolder" function. On Linux, prepend a
>> "." to the beginning of the name as well, since the Preferences Folder
>> is the user's home directory, and that's just "The Way It Is."
>
> Prepend a "." to the name of the preference file?

Yes, on Linux. For example, .bash_rc, .ssh, .java, .Xauthority, etc. If
you're at a Linux box, just launch a terminal, type "cd ~", then "ls
-a", and note that all of your preferences for that user are there.

HTH,
Jon





Links
MBS Filemaker Plugins - Bilder aus Nickenich