[Pharo-project] [squeak-dev] Accessing external resources in a cross-platform way

Hernán Morales Durand hernan.morales at gmail.com
Thu Feb 3 01:01:10 CET 2011


I've just implemented an initial release on top of FileSystem and
ProcessWrapper (it uses some bit of Grease too). This is how it works
in Windows:

( FSLocator sysEnvBinaries / 'notepad.exe' ) resolve	"
C:\WINDOWS\system32\notepad.exe "
( FSLocator sysEnvBinaries / 'X264VFW.DLL' ) resolve	"
C:\WINDOWS\system32\X264VFW.DLL "
( FSLocator userBinaries / 'excel.exe' ) resolve		" C:\Archivos de
programa\Microsoft Office\OFFICE11\EXCEL.EXE "
( FSLocator userBinaries / 'firefox.exe' ) resolve		" C:\Archivos de
programa\Mozilla Firefox\firefox.exe"

So #sysEnvBinaries search in the OS PATH environment variable
locations (which is usually pretty fast) and #userBinaries in the
"program files" locations (it could be slow depending the amount of
entries). It's only tested under Windows, IIRC user binaries in Unix
are inside "/usr/local/bin" but you may tweak it to other locations, I
have no access to a Unix or MacOS. Feel free to suggest or add any
enhacements you like.
Cheers,

Hernán

2011/1/28 Colin Putney <colin at wiresong.com>:
> On Fri, Jan 28, 2011 at 9:17 AM, Hernán Morales Durand
> <hernan.morales at gmail.com> wrote:
>> Thanks David,
>>
>> I've seen FileSystem package http://www.wiresong.ca/filesystem/
>> it seems related in some way too
>
> Yes, FileSystem does attempt to provide a cross-platform way to
> resolve paths that are system-dependent. It doesn't include a way to
> search for executables, although that's a good feature idea. As David,
> mentioned you probably want to get the value of the PATH environment
> variable, and use that for your search. That will handle cross-host
> differences as well as cross-platform issues.
>
> Colin
>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Fsextensions-hfm.2.mcz
Type: application/octet-stream
Size: 4355 bytes
Desc: not available
URL: <http://lists.gforge.inria.fr/pipermail/pharo-project/attachments/20110203/d07dbf80/attachment.obj>


More information about the Pharo-project mailing list