|
From: creedon <icr...@us...> - 2005-08-07 23:18:42
|
Update of /cvsroot/frontierkernel/odbs/frontierRoot/system/verbs/builtins/file In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13278 Modified Files: getSpecialFolderPath Log Message: added Documents folder case for Mac OS Carbon, suggest by Sean Elfstrom from a doc server discussion group message Index: getSpecialFolderPath =================================================================== RCS file: /cvsroot/frontierkernel/odbs/frontierRoot/system/verbs/builtins/file/getSpecialFolderPath,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** getSpecialFolderPath 26 Mar 2005 19:42:46 -0000 1.1.1.1 --- getSpecialFolderPath 7 Aug 2005 23:18:33 -0000 1.2 *************** *** 1,3 **** FrontierVcsFile:1:scpt:system.verbs.builtins.file.getSpecialFolderPath ! on getSpecialFolderPath (vol, specialfolder, create) { ÇChanges: Ç5.0.1 dmb: added "temporary item" support for Windows Çmaps to the Temp directory Ç8/26/01; 11:30:11 PM by JES ÇAdded support for special folders used for MacOS X. on kernelcall (vol, specialfolder, create) { kernel (file.getSpecialFolderPath)}; case sys.os () { "MacOS" { if system.environment.isCarbon { if vol == "" { vol = file.getSystemDisk ()}; local (pc = file.getPathChar ()); local (folder); on getUserFolder () { local (username = string.nthField (sys.unixShellCommand ("who am i"), ' ', 1)); return (vol + "Users" + pc + username + pc)}; case string.lower (specialfolder) { "apple menu items" { scriptError ("Can't get the path to the Apple Menu Items folder because Mac OS X does not have an Apple Menu Items folder.")}; "applications" { folder = vol + "Applications" + pc}; "desktop folder" { folder = getUserFolder () + "Desktop" + pc}; "extensions" { folder = vol + "System" + pc + "Extensions" + pc}; "favorites" { folder = getUserFolder () + "Library" + pc + "Favorites" + pc}; "fontcollections" { folder = getUserFolder () + "Library" + pc + "FontCollections" + pc}; "fonts" { folder = getUserFolder () + "Library" + pc + "Fonts" + pc}; "preferences" { folder = getUserFolder () + "Library" + pc + "Preferences" + pc}; "startup items"; "startupitems" { scriptError ("Can't get the path to the Startup Items folder because Mac OS X does not have a Startup Items folder.")}; "system"; "system folder" { folder = vol + "System" + pc}; "temp"; "temporary items" { folder = vol + "Temporary Items" + pc}; "trash" { folder = vol + "Trash" + pc}}; if create { file.sureFilePath (folder); file.sureFolder (folder)}; return (filespec (folder))} else { //Classic kernelcall (vol, specialfolder, create)}}; "Win95"; "WinNT" { ÇMonday, December 8, 1997 at 3:59:21 PM by DW Ç"Desktop" -- Windows desktop - virtual folder at the root of the name space. Ç"DesktopDirectory" -- File system directory used to physically store file Çobjects on the desktop (not to be confused with the desktop folder itself). Ç"Fonts" -- Virtual folder containing fonts. Ç"NetHood" -- File system directory containing objects that appear in the network neighborhood. Ç"Personal" -- File system directory that serves as a common respository for documents Ç"Programs" -- File system directory that contains the user's program groups (which are also file system directories). Ç"Recent" -- File system directory that contains the user's most recently used documents. Ç"SendTo" -- File system directory that contains Send To menu items. Ç"StartMenu" -- File system directory containing Start menu items. Ç"StartUp" -- File system directory that corresponds to the user's Startup program group. Ç"Templates" -- File system directory that serves as a common repository for document templates. Ç"Windows" -- The Windows directory is the directory where an application Çshould store initialization and help files. If the user is running a shared Çversion of Windows, the Windows directory is guaranteed to be private for Çeach user. Ç"System" -- Retrieves the path of the Windows system directory. ÇThe system directory contains such files as Windows libraries, drivers, and font files case string.lower (specialfolder) { "preferences" { return (file.getPrefsSubFolder (specialfolder))}; "temp" { local (tempfolder); if vol == "" { vol = file.getSystemDisk ()}; vol = vol [1] + ":\\"; tempfolder = vol + "Temp\\"; if create and not file.exists (tempfolder) { try {file.sureFolder (tempfolder)}}; return (tempfolder)}} else { try { return (kernelcall (vol, specialfolder, create))} else { local (errormessage); if string.lower (string.firstword (specialfolder)) == "temporary" { local (folder); if vol == "" { vol = file.getSystemDisk ()}; folder = vol + "\\Temp\\"; if create { file.sureFolder (folder)}; return (true)}; errormessage = "Couldn't get the folder path because \"" + specialfolder; errormessage = errormessage + "\" is not a special folder name."; return (scriptError (errormessage))}}}}}; Çbundle //testing Çfile.getSpecialFolderPath ("", "temp", true) \ No newline at end of file --- 1,3 ---- FrontierVcsFile:1:scpt:system.verbs.builtins.file.getSpecialFolderPath ! on getSpecialFolderPath (vol, specialfolder, create) { ÇChanges Ç8/3/05; 3:20:59 PM by TAC Çadded Documents folder case for Mac OS Carbon, suggest by Sean Elfstrom from a doc server discussion group message Ç8/26/01; 11:30:11 PM by JES ÇAdded support for special folders used for MacOS X. Ç5.0.1 dmb: added "temporary item" support for Windows Çmaps to the Temp directory on kernelcall (vol, specialfolder, create) { kernel (file.getSpecialFolderPath)}; case sys.os () { "MacOS" { if system.environment.isCarbon { if vol == "" { vol = file.getSystemDisk ()}; local (pc = file.getPathChar ()); local (folder); on getUserFolder () { local (username = string.nthField (sys.unixShellCommand ("who am i"), ' ', 1)); return (vol + "Users" + pc + username + pc)}; case string.lower (specialfolder) { "apple menu items" { scriptError ("Can't get the path to the Apple Menu Items folder because Mac OS X does not have an Apple Menu Items folder.")}; "applications" { folder = vol + "Applications" + pc}; "desktop folder" { folder = getUserFolder () + "Desktop" + pc}; "documents" { folder = getUserFolder () + "Documents" + pc}; "extensions" { folder = vol + "System" + pc + "Extensions" + pc}; "favorites" { folder = getUserFolder () + "Library" + pc + "Favorites" + pc}; "fontcollections" { folder = getUserFolder () + "Library" + pc + "FontCollections" + pc}; "fonts" { folder = getUserFolder () + "Library" + pc + "Fonts" + pc}; "preferences" { folder = getUserFolder () + "Library" + pc + "Preferences" + pc}; "startup items"; "startupitems" { scriptError ("Can't get the path to the Startup Items folder because Mac OS X does not have a Startup Items folder.")}; "system"; "system folder" { folder = vol + "System" + pc}; "temp"; "temporary items" { folder = vol + "Temporary Items" + pc}; "trash" { folder = vol + "Trash" + pc}}; if create { file.sureFilePath (folder); file.sureFolder (folder)}; return (filespec (folder))} else { //Classic kernelcall (vol, specialfolder, create)}}; "Win95"; "WinNT" { ÇMonday, December 8, 1997 at 3:59:21 PM by DW Ç"Desktop" -- Windows desktop - virtual folder at the root of the name space. Ç"DesktopDirectory" -- File system directory used to physically store file Çobjects on the desktop (not to be confused with the desktop folder itself). Ç"Fonts" -- Virtual folder containing fonts. Ç"NetHood" -- File system directory containing objects that appear in the network neighborhood. Ç"Personal" -- File system directory that serves as a common respository for documents Ç"Programs" -- File system directory that contains the user's program groups (which are also file system directories). Ç"Recent" -- File system directory that contains the user's most recently used documents. Ç"SendTo" -- File system directory that contains Send To menu items. Ç"StartMenu" -- File system directory containing Start menu items. Ç"StartUp" -- File system directory that corresponds to the user's Startup program group. Ç"Templates" -- File system directory that serves as a common repository for document templates. Ç"Windows" -- The Windows directory is the directory where an application Çshould store initialization and help files. If the user is running a shared Çversion of Windows, the Windows directory is guaranteed to be private for Çeach user. Ç"System" -- Retrieves the path of the Windows system directory. ÇThe system directory contains such files as Windows libraries, drivers, and font files case string.lower (specialfolder) { "preferences" { return (file.getPrefsSubFolder (specialfolder))}; "temp" { local (tempfolder); if vol == "" { vol = file.getSystemDisk ()}; vol = vol [1] + ":\\"; tempfolder = vol + "Temp\\"; if create and not file.exists (tempfolder) { try {file.sureFolder (tempfolder)}}; return (tempfolder)}} else { try { return (kernelcall (vol, specialfolder, create))} else { local (errormessage); if string.lower (string.firstword (specialfolder)) == "temporary" { local (folder); if vol == "" { vol = file.getSystemDisk ()}; folder = vol + "\\Temp\\"; if create { file.sureFolder (folder)}; return (true)}; errormessage = "Couldn't get the folder path because \"" + specialfolder; errormessage = errormessage + "\" is not a special folder name."; return (scriptError (errormessage))}}}}}; Çbundle //testing Çfile.getSpecialFolderPath ("", "documents", true) \ No newline at end of file |