Hi, what is the simplest way to change working directory from dolphin
program? Thanks, rush |
> Hi, what is the simplest way to change working directory from dolphin
> program? Do you really need to do that? My preference has always been to specify full paths so that I'm not disappointed if somebody else knows how to change it :) Have a good one, Bill -- Wilhelm K. Schwab, Ph.D. [hidden email] |
In reply to this post by rush
Davorin,
> Hi, what is the simplest way to change working directory from dolphin > program? As you probably noticed Dolphin provides a method to get the current working directory (File class>>workingDirectory) but not one to set it. This method uses the crt library api and there may (must?) be a matching "set" operation - but not having the c rtl docs I don't really know for sure. However, there is a "normal" api that does this as well (and is probably used by the c rtl anyway?). If you add KernelLibrary>>getCurrentDirectory: cchCurDir lpszCurDir: lpszCurDir <stdcall: dword GetCurrentDirectoryA dword lpstr> ^self invalidCall and KernelLibrary>>setCurrentDirectory: lpszCurDir <stdcall: bool SetCurrentDirectoryA lpstr> ^self invalidCall You can then do dir := String new: 256. KernelLibrary default getCurrentDirectory: dir size lpszCurDir: dir. to get the current directory in dir and KernelLibrary default setCurrentDirectory: 'c:\program files' to set it. I have to agree with Bill though. This sort of thing is a bit outdated these days and I would think a lot of apps would ignore the setting anyway. Regards Ian |
"Ian Bartholomew" <[hidden email]> wrote in message
news:fx0i9.6425$571.597963@wards... > Davorin, > KernelLibrary>>setCurrentDirectory: lpszCurDir > <stdcall: bool SetCurrentDirectoryA lpstr> > ^self invalidCall Ian, and Bill Thanks for the solution and also for the comments. The addition to the kernel library does the trick. > I have to agree with Bill though. This sort of thing is a bit outdated these > days and I would think a lot of apps would ignore the setting anyway. I need it for small activex wrapper around the info-zip library. I have gotten myself exicited when I got it to work in Dolphin (thanks to activex wizard) in just a few minutes after I have downloaded it, and this was my first activex try. The wrapper is quite simple and lets you create zip files in a snap. Anyway, to get only desired part of the path recorded in the zip archieve, you need to set the working directory, hence the question. If anyone is interested the wrapper can be found at: http://www.codeguru.com/vb/articles/1854.shtml and as said, activex wizard will handle it with grace. rush |
Davorin,
> I need it for small activex wrapper around the info-zip library. I have > gotten myself exicited when I got it to work in Dolphin (thanks to activex > wizard) in just a few minutes after I have downloaded it, and this was my > first activex try. The amazing part is that Blair managed to write the analyzer without the analyzer. > The wrapper is quite simple and lets you create zip files in a snap. Anyway, > to get only desired part of the path recorded in the zip archieve, you need > to set the working directory, hence the question. Could you simply to "arithmetic" on the paths? It seems that you should be able to convince file locators to extract what you want w/o having to set something in the OS. Please let us know how you get along with InfoZip. I learned about just it a couple of days ago when I was upgrading my OpenOffice (www.openofice.org) installation, but haven't had a chance to look into it yet. Have a good one, Bill -- Wilhelm K. Schwab, Ph.D. [hidden email] |
In reply to this post by Ian Bartholomew-17
I did the following:
CRTLibrary>>_chdir: dir "Set the current working directory to dir." <cdecl: sdword _chdir lpstr> ^self invalidCall and: File>>workingDirectory: dir "Set the current working directory." ^(CRTLibrary default _chdir: dir) = 0 Regards. ---- Dominique Dartois |
In reply to this post by Bill Schwab
"Bill Schwab" <[hidden email]> wrote in message
news:amakkq$of0$[hidden email]... > Could you simply to "arithmetic" on the paths? It seems that you should be > able to convince file locators to extract what you want w/o having to set > something in the OS. I think not, since I prepare the list of the filenames, and hand it over to the dll. It is the dll that does opening of those files, and it is not aware of Dolphin file locators. (there is a method rootDirectory in the control, but it does not work properly). So I change the working directory, and then hand over the relative paths to the library, which is then able to open them and put them into he archive. > Please let us know how you get along with InfoZip. I learned about just it > a couple of days ago when I was upgrading my OpenOffice (www.openofice.org) > installation, but haven't had a chance to look into it yet. I think Info-Zip is mature, and that interfacing directly to it would be a very solid solution. Anyway, interfacing to the CGInfoZip was much less work for me, and it seems to do what I need: "create simple zip files with minimum effort". Creating a zip file is a three-liner with it. If you are interested, you can download generated wrapper with a small example and needed dll's from: http://www.templatetamer.org/index.php?CgInfoZip rush |
Free forum by Nabble | Edit this page |