realbasic-nug
[Top] [All Lists]

Re: Problem with CFPreferences and SwapFile

To: "REALbasic Network Users Group" <realbasic-nug at lists dot realsoftware dot com>
Subject: Re: Problem with CFPreferences and SwapFile
From: Kevin Ballard <kevin at sb dot org>
Date: Sun, 29 Feb 2004 22:43:30 -0500
Cc: Bruce Giles <bruce at blueflashsoft dot com>
References: <a060204aebc67eb446db2 at [192 dot 168 dot 1 dot 104]>
Ouch. I forgot SwapFile used FSSpecs. I'll look into the problem immediately.

On Feb 29, 2004, at 2:58 PM, Bruce L Giles wrote:

I'm using Kevin Ballard's CFPreferences (thanks, Kevin!), which uses SwapFile from the CarbonDeclareLibrary. Everything was working perfectly, and I was able to write a properly formatted preferences (plist) file to the Preferences folder -- until I changed the name of my application. Because of the name change, I also changed the name that I passed to CFPreferences, and that seems to be the problem.

Originally, when my app was working, I was passing "com.blueflashsoft.Demo" in the New CFPreferences call. Then I changed it to "com.blueflashsoft.PrefsDemo", and it suddenly stopped working. I would correctly get a file in my Preferences folder called "com.blueflashsoft.PrefsDemo.plist", but it was an empty file.

I stepped through the whole thing in the debugger, and discovered that the problem seems to be the length of the preference file name. My preferences file is correctly written to the temporary folder, but SwapFile fails to do the swap if the length of the file name is greater than 32. Thus, "com.blueflashsoft.Demo.plist" is successfully written to the Preferences folder, while "com.blueflashsoft.PrefsDemo.plist" is not.

In fact, if I look at the dest parameter for SwapFile, I see that, when I specify a name that's too long, the Absolute Path property of the folderItem looks something like this:

Opus:Users:bgiles:Library:Preferences:com.blueflashsoft.#345CCB.plist

while with a shorter name, I see something like this:

Opus:Users:bgiles:Library:Preferences:com.blueflashsoft.Demo.plist

Is this a bug, or a "feature", and is there a fix, or a workaround?

I know that OS 9 had a 31 character limit on file names, but I'm running OS X (Panther), and the limit in my application seems to be 32 characters, not 31, so I'm not really sure what's going on here.

Since I have a relatively long domain name, this seems to limit me to eight-character application names, if I want to use the standard naming convention for preference files.

Any ideas?

--
Kevin Ballard
kevin at sb dot org
http://www.tildesoft.com
http://kevin.sb.org



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

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

<Prev in Thread] Current Thread [Next in Thread>