Re: Searching for paths
- Posted by akusaya at gmx.net Feb 25, 2002
- 465 views
For windows directory you can use this function... function ambilwindir() = your windows directory object ambilwindir_kernel32 ambilwindir_kernel32 = open_dll("kernel32.dll") object ambilwindir_GetWindowsDirectory ambilwindir_GetWindowsDirectory = define_c_func(ambilwindir_kernel32, "GetWindowsDirectoryA", {C_POINTER, C_LONG}, C_LONG) global function ambilwindir() object hasil, len hasil = allocate_string(repeat(0,254)) len = c_func(ambilwindir_GetWindowsDirectory, {hasil, 255}) return peek({hasil, len}) end function b> Hi all, b> I need to determine the Euphoria directory, and the Windows directory. b> I can use get_env() to get %EUDIR and %WINDIR. b> What if one/both of those don't exist? b> I can do a walk_dir() search for ex.exe and win.exe(com?), but is that b> sufficient? Any one computer can have more than one copy of both EU and b> Windows. What if the file I'm looking for has been renamed? b> How can I guarantee that I have found the right directories? b> Would I find win.exe on >win98 ? b> My plan so far is to check the environment variables, if I can't find b> them, then I walk_dir() starting from C:\ looking for ex.exe, even if I b> find it, continue searching to determine if there is a second copy. b> If I find a second copy, then I can't verify the Euphoria directory, and b> the user must be prompted for it. b> Same for WINDIR. I could see this being pretty slow though. b> Maybe I'm just trying too hard to automate it. b> My second plan is to just search for the specific directory if the b> environment variable doesn't exist. Can't find %EUDIR variable, then b> check if C:\Euphoria exists, if not, prompt the user. b> Also, is there a simple DOS way of determining the drive letters b> available? So I can walk the drives as well. b> Thanx b> Chris