On Thu, 24 Jul 2014, Antonio S??nchez wrote: > Hi > > Is there any way to exec scripts inside project folder without copy it to > another place? >
There are multiple ways. First, you can just execute the script from an absolute path using Application.Path &/ "myscript". This method, however, will fail when your project is compiled into an executable archive (.gambas) because then there is no file actually. Since there is no concept of a CWD in Gambas, relative paths are used to address this issue: they identify files in your project directory, even if your Gambas process runs from an executable archive. This is the reason why you mostly see code that first copies project files to temporary locations before they're passed to external processes. If it's a script, or any data you can *pipe* into some process to have it handled, you can also read the project file into a String and pipe it to the process. No need to copy the file then. But IMHO, this is a little cumbersome as you have to open your interpreter as a pipe'd Process: Dim hProc As Process hProc = Exec ["sh"] For Read Write #hProc, File.Load("myscript") I don't know if this code works by copy and paste but the working pendant should be at least very similar. > Is there any way to copy a lot of files, or even, a folder with a lot of > files located inside your project folder to any path in your home? > As said above, you can use relative paths to address your project files. This works transparently in Gambas, i.e. you can use this feature in any filesystem-related function and it will work (I hope I'm not making too strong promises here). So to list all project files recursively, try: Dim sRel As String For Each sRel In RDir(".") Print sRel Next It's analog for specific folders. Of course you would use Copy to copy these relative paths to somewhere. Regards, Tobi -- "There's an old saying: Don't change anything... ever!" -- Mr. Monk ------------------------------------------------------------------------------ Want fast and easy access to all the code in your enterprise? Index and search up to 200,000 lines of code with a free copy of Black Duck Code Sight - the same software that powers the world's largest code search on Ohloh, the Black Duck Open Hub! Try it now. http://p.sf.net/sfu/bds _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user