[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] FindFolder puzzler



John W Baxter wrote:
>>And I think it's no longer the paths to *all* the standard folders, which
>>now include the Applications and Documents folders (Documents is more
>>important in Mac OS 9 than it has been since OpenDoc bit the dust), the
>>Scripting Additions folder (the one in the System Folder, not the obsolet=
e
>>one in Extensions) and several others.

Chris nandor wrote:
>Take a deep breath ... (you can hardcode these values in MacPerl's
>FindFolder, even if the constants are not included ... I suppose these
>should be included in the next MacPerl release).

alternatively, just pass the folder type code, see the following script:

__BEGIN__
#! perl -w

use diagnostics-verbose;
use strict;


#-=3D-=3D-=3D-=3D-=3DDeclare Includes-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=
=3D-=3D
use File::Find;
use Mac::Files;

#-=3D-=3D-=3D-=3D-=3DDeclare Variables-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=
=3D

my ($trash,$code,$path,@codes,@temp);

#-=3D-=3D-=3D-=3D-=3DScript Body-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=
=3D-=3D-=3D
while(<DATA>){
    tr/ //d;
    tr/\'//d;
    ($trash,$code)=3D split('=3D');
    chomp($code);

    push(@codes,$code);


}

@temp=3Dsort(@codes);
foreach $code (@temp){
=09$path=3DFindFolder(kOnSystemDisk(),$code);

=09print "file type=3D-> $code \tpath=3D-> $path\n"if defined($path);
    }


#-=3D-=3D-=3D-=3D-=3DSubroutine separator-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=
=3D

__DATA__
kSystemFolderType =3D 'macs'
kDesktopFolderType =3D 'desk'
kTrashFolderType =3D 'trsh'
kWhereToEmptyTrashFolderType =3D 'empt'
kPrintMonitorDocsFolderType =3D 'prnt'
kStartupFolderType =3D 'strt'
kShutdownFolderType =3D 'shdf'
kFontsFolderType =3D 'font'
kAppleMenuFolderType =3D 'amnu'
kControlPanelFolderType =3D 'ctrl'
kExtensionFolderType =3D 'extn'
kPreferencesFolderType =3D 'pref'
kTemporaryFolderType =3D 'temp'
kExtensionDisabledFolderType =3D 'extD'
kControlPanelDisabledFolderType =3D 'ctrD'
kSystemExtensionDisabledFolderType =3D 'macD'
kStartupItemsDisabledFolderType =3D 'strD'
kShutdownItemsDisabledFolderType =3D 'shdD'
kApplicationsFolderType =3D 'apps'
kDocumentsFolderType =3D 'docs'
kVolumeRootFolderType =3D 'root'
kChewableItemsFolderType =3D 'flnt'
kApplicationSupportFolderType =3D 'asup'
kTextEncodingsFolderType =3D '=9Ftex'
kStationeryFolderType =3D 'odst'
kOpenDocFolderType =3D 'odod'
kOpenDocShellPlugInsFolderType =3D 'odsp'
kEditorsFolderType =3D 'oded'
kOpenDocEditorsFolderType =3D '=9Fodf'
kOpenDocLibrariesFolderType =3D 'odlb'
kGenEditorsFolderType =3D '=9Fedi'
kHelpFolderType =3D '=9Fhlp'
kInternetPlugInFolderType =3D '=9Fnet'
kModemScriptsFolderType =3D '=9Fmod'
kPrinterDescriptionFolderType =3D 'ppdf'
kPrinterDriverFolderType =3D '=9Fprd'
kScriptingAdditionsFolderType =3D '=9Fscr'
kSharedLibrariesFolderType =3D '=9Flib'
kVoicesFolderType =3D 'fvoc'
kControlStripModulesFolderType =3D 'sdev'
kAssistantsFolderType =3D 'ast=9F'
kUtilitiesFolderType =3D 'uti=9F'
kAppleExtrasFolderType =3D 'aex=9F'
kContextualMenuItemsFolderType =3D 'cmnu'
kMacOSReadMesFolderType =3D 'mor=9F'
kALMModulesFolderType =3D 'walk'
kALMPreferencesFolderType =3D 'trip'
kALMLocationsFolderType =3D 'fall'
kColorSyncProfilesFolderType =3D 'prof'
kThemesFolderType =3D 'thme'
kFavoritesFolderType =3D 'favs'
kInternetFolderType =3D 'int=9F'
kAppearanceFolderType =3D 'appr'
kSoundSetsFolderType =3D 'snds'
kDesktopPicturesFolderType =3D 'dtp=9F'
kInternetSearchSitesFolderType =3D 'issf'
kFindSupportFolderType =3D 'fnds'
kFindByContentFolderType =3D 'fbcf'
kInstallerLogsFolderType =3D 'ilgf'
kScriptsFolderType =3D 'scr=9F'
kFolderActionsFolderType =3D 'fasf'
kLauncherItemsFolderType =3D 'laun'
kRecentApplicationsFolderType =3D 'rapp'
kRecentDocumentsFolderType =3D 'rdoc'
kRecentServersFolderType =3D 'rsvr'
kSpeakableItemsFolderType =3D 'spki'
__END__

# =3D=3D=3D=3D=3D Want to unsubscribe from this list?
# =3D=3D=3D=3D=3D Send mail with body "unsubscribe" to macperl-request@macp=
erl.org