How can Squeak get Windows root directory ?
Andreas Raab
andreas.raab at gmx.de
Sat Aug 20 01:13:36 UTC 2005
That's probably overkill for most situations ;-) How about just:
Win32Utils>>apiGetEnvironmentVariable: lpName with: lpBuffer with: nSize
<apicall: ulong 'GetEnvironmentVariableA' (char* byte* ulong) module:
'kernel32.dll'>
^self externalCallFailed
Win32Utils>>getEnvironmentVariable: aString
"Win32Utils getEnvironmentVariable: 'windir'"
| buffer size |
size := self apiGetEnvironmentVariable: aString with: nil with: 0.
buffer := String new: size.
self apiGetEnvironmentVariable: aString with: buffer with: size.
^buffer allButLast
Cheers,
- Andreas
John Pierce wrote:
> Hi Bret,
>
> I know you won't like this answer, but download .NET Framework 1.1 and
> install (probably already have it), and download and install Squeak .NET
> Bridge on SqueakMap, then....
>
> Run the following in a workspace:
>
> DotNet Environment getEnvironmentVariable: #windir
>
> Voila!
>
> Regards,
>
> John
>
> On 8/19/05, *Bert Freudenberg* <bert at impara.de <mailto:bert at impara.de>>
> wrote:
>
> Sure. Your question sounded like you wanted to access the root
> directory.
>
> So you actually want some platform-dependent information. Well, look
> up what you would do in another programming environment to access
> that information. Then do the same from Squeak. If you do not know
> how to do that from Squeak, please explain that specific problem here.
>
> - Bert -
>
> Am 19.08.2005 um 18:04 schrieb IPSistemos:
>
> > Hello,
> >
> > "FileDirectory root" does not return C:\WINDOWS as expected for the
> > WINDOWS XP user.
> >
> > Friday, August 19, 2005, 6:09:13 PM, you wrote:
> >
> >> Am 19.08.2005 um 14:40 schrieb Valdas Bucinskas:
> >>
> >
> >
> >>> Hi,
> >>>
> >>> I am new to Squeak and smalltalk. I would like to know, how can I
> >>> obtain the
> >>> windows root directory with Squeak?
> >>>
> >
> >
> >> FileDirectory root
>
>
>
>
>
>
>
> --
> It's easy to have a complicated idea. It's very very hard to have a
> simple idea. -- Carver Mead
>
>
> ------------------------------------------------------------------------
>
>
More information about the Squeak-dev
mailing list
|