The Omni Group Forums

The Omni Group Forums (
-   OmniFocus Extras (
-   -   OmniFocus bought thru AppStore: Cache-querying scripts fail (

RobTrew 2011-06-25 01:11 AM

OmniFocus bought thru AppStore: Cache-querying scripts fail
Various scripts on this board query the cache, and typically start with a property like:

[CODE]property pstrDBPath : "~/Library/Caches/com.omnigroup.OmniFocus/OmniFocusDatabase2"[/CODE]

AppStore-purchased copies of OmniFocus can not run these scripts without modification.

A possible modification might be something like the following (though this is not bullet-proof):

[CODE]set pstrDBPath to GetCachePath()

on GetCachePath()
set strDefaultFolder to "~/Library/Caches/com.omnigroup.OmniFocus"
set strAppStoreFolder to "~/Library/Caches/com.omnigroup.OmniFocus.MacAppStore"
set strDBName to "OmniFocusDatabase2"

set strCacheFolder to strDefaultFolder
if (do shell script ("test -d " & strCacheFolder & "; echo $?")) ≠ "0" then
set strCacheFolder to strAppStoreFolder
if (do shell script ("test -d " & strCacheFolder & "; echo $?")) ≠ "0" then return ""
end if

return strCacheFolder & "/" & strDBName
end GetCachePath[/CODE]


RobTrew 2011-06-29 03:38 PM

Or, I suppose, you could try using "System Events" to read the [I]Bundle identifier[/I] key in the [I]info.plist[/I] file inside the package.

(Looking first in [I]/Applications/[/I] and then perhaps falling back to [I]~/Applications/[/I] if it wasn't found ...)

(But this kind of thing is, of course, hard to test because it is in the nature of the bifurcated bundle identifier problem that any given user only has one version installed, and can't test code for the other ... )

(I have asked the Ninjas whether there is a better solution to automatically detecting whether a user's data is in a com.omnigroup.OmniFocus cache or a com.omnigroup.OmniFocus.MacAppStore cache ...)



All times are GMT -8. The time now is 02:00 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2021, vBulletin Solutions, Inc.