|
From: <cre...@us...> - 2006-05-05 19:12:47
|
Revision: 1359 Author: creecode Date: 2006-05-05 12:12:44 -0700 (Fri, 05 May 2006) ViewCVS: http://svn.sourceforge.net/frontierkernel/?rev=1359&view=rev Log Message: ----------- added testing for Mac OS minor script format tweaks Modified Paths: -------------- ODBs/trunk/frontierRoot/system/verbs/builtins/file/findApplication.fvc Modified: ODBs/trunk/frontierRoot/system/verbs/builtins/file/findApplication.fvc =================================================================== --- ODBs/trunk/frontierRoot/system/verbs/builtins/file/findApplication.fvc 2006-05-05 19:11:04 UTC (rev 1358) +++ ODBs/trunk/frontierRoot/system/verbs/builtins/file/findApplication.fvc 2006-05-05 19:12:44 UTC (rev 1359) @@ -1,43 +1,65 @@ -FrontierVcsFile:1:scpt:system.verbs.builtins.file.findApplication +FrontierVcsFile:2:scpt:system.verbs.builtins.file.findApplication on findApplication (creator) { - \xC7Changes: - \xC705/11/01; 6:54:10 PM by JES - \xC7If the kernel call fails on Windows, try to find the application by examining the registry directly (if the winRegistry verb is present). + «Changes + «4/10/06; 6:49:23 PM by TAC + «added testing for Mac OS + «minor script format tweaks + «05/11/01; 6:54:10 PM by JES + «If the kernel call fails on Windows, try to find the application by examining the registry directly (if the winRegistry verb is present). + on kernelCall (creator) { kernel (file.findApplication)}; + if system.environment.isMac { return (kernelCall (creator))} - else { //Windows + else { // Windows local (appPath = ""); - try { //this will fail for extensions longer than 4 chars + + try { // this will fail for extensions longer than 4 chars appPath = kernelCall (creator)}; + if not defined (winRegistry.read) { return (appPath)}; - if appPath == "" { //look in the registry + + if appPath == "" { // look in the registry local (fileType = winRegistry.read ("HKCR\\." + creator)); - if not fileType { //winRegistry.read returns false if there's no key at the specified path + + if not fileType { // winRegistry.read returns false if there's no key at the specified path return (appPath)}; + local (systemPath = file.folderFromPath (file.getSystemFolderPath ())); + systemPath = string.popTrailing (systemPath, "\\"); + local (command = winRegistry.read ("HKCR\\" + fileType + "\\shell\\open\\command\\")); + command = string.trimWhiteSpace (command); + if command beginsWith "\"" { appPath = string.nthField (command, "\"", 2)} - else { //parse the command + else { // parse the command local (ch, ix = 0, ct = sizeOf (command)); + loop { if ++ix == ct { break}; - ch = command[ix]; + + ch = command [ix]; + if ch == " " { - case command[ix+1] { + case command [ix+1] { "%"; "\""; "/" { appPath = string.mid (command, 1, ix); break}}}}; + appPath = string.replace (appPath, "%SystemRoot%", systemPath)}}; - return (appPath)}}; -\xC7bundle //test code - \xC7findApplication ("txt") \ No newline at end of file + + return (appPath)}} +«bundle // testing + «bundle // Mac OS + «findApplication ('!Rch') + «bundle // Windows + «findApplication ("txt") \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |