Title: Creating a directory on the PC Post by: Sally W. on February 24, 2010, 04:40:51 pm I would like to be able to create a directory on the PC so I can copy templates and data for mailmerge into it. It will be far easier to do it from the code than by getting the folks managing the PCs to make sure the directory exists on every single PC, plus we can change it much more easily if we ever want. The following test program shows the sorts of things I have tried, all to no avail. Has anyone here done this? If so, do you have a code fragment you can share, please?
(this is Genero 2.1 on Solaris, with the front-end running on Windows PCs) Code
Title: Re: Creating a directory on the PC Post by: . on February 24, 2010, 05:33:22 pm Don"t forget that on windows mkdir is not an executable but a command of cmd.exe
(from my testing you even can't type "mkdir c:\zz" in windows "execute" box). So you've first to run cmd.exe and then give the command, for instance: let l_string = "cmd.exe /C \"mkdir c:\\zz\"" which can be called using shellexec. Title: Re: Creating a directory on the PC Post by: Sally W. on February 24, 2010, 05:46:23 pm Bingo - that works! And it works with FrontCall as well.
Many thanks. Case closed. Title: Re: Creating a directory on the PC Post by: Reuben B. on February 26, 2010, 12:44:44 am Pierre-Nicolas,
Is it potentially possible to take the library distributed with the Windows runner %FGLDIR%/lib/os.dll, place it in the %GDCDIR%/lib folder and call the same methods https://4js.com/techdocs/genero/fgl/devel/DocRoot/User/Ext_os_Path.html#METHODS via a front-end extension https://4js.com/techdocs/genero/gdc/devel/DocRoot/User/FEExtensions.html i.e CALL ui.Interface.frontCall("os","mkdir",dirname, ok) Reuben Title: Re: Creating a directory on the PC Post by: . on February 26, 2010, 08:26:02 am Not directly ; if the DLL you would like to load is not a GDC specific DLL, you'll need to rite a wrapper around it.
I don't know if os.DLL has been built the same way as C-extensions or if it has its own interface, but explanation below is valid whatever interface has been chosen: To load a DLL dynamically, a program (gdc.exe or fglrun.exe) needs to know the function definition. With GDC, all functions must be like: int functionName(struct frontEndInterface & fx); where fx is a structure allowing the DLL to read in parameter and push out parameters. with the DVM, the interface is much more complex, based on Informix. you can see it in f2c/fglExt.h. Most of Informix types can be passed, and a lot of functions / macro as proposed too. GDC api is very simple: call the function, get string / int parameter, return in / string parameter. So what you would need to do is to make something like (thinking loud, I would not bet this compile directly ;) ) : Code
and of couse loadDVMLib() and execDVMFunction() should be very similar to the code we have in the runtime. While this is potentially doable, I would either try to make it with a bunch of shellexec calls, or with my own library: Code
|