Jeff Steinkamp 1 Posted December 10, 2022 The project I am working on requires 4 external text files, 3 with SQL data and 1 with CSV data that can be read at runtime when necessary. How do we include these into the project, so they get read into the output folder. In Visual Studio, this was rather simple. Include the files in the project and set the property to include them in the output folder. I have yet to find anything similar in Delphi. Share this post Link to post
programmerdelphi2k 237 Posted December 10, 2022 (edited) In RAD Studio it's so easy too! you can add any file in your project, of course, your "EXE"/DLL/etc... it will be "bloated" depending on the type of file you will include! in your case, I think that using "Deployment" menu will be better, because you can define where yours files will be placed, including what names it will have! other way, you can use the "events"when compiling your project... but I think that your better choice is "Deployment" Edited December 10, 2022 by programmerdelphi2k 1 Share this post Link to post
Jeff Steinkamp 1 Posted December 10, 2022 I've dropped those files into the project manager. I see nothing that resembles the Deployment screen you show above. I get this: But, at this stage of the game I'm not even close to project deployment, I am barely into the development phase. But I do need these files in the output folder for continued development. I'm not sure exactly how the build events are helpful unless there are some commands that can be used to copy these files during the pre-build event. Share this post Link to post
Attila Kovacs 629 Posted December 10, 2022 (edited) Just for curiosity, why don't you just copy the 4 files into the output folder manually and move on? Edited December 10, 2022 by Attila Kovacs Share this post Link to post
programmerdelphi2k 237 Posted December 11, 2022 (edited) hi @Jeff Steinkamp you can choice between two ways above (or any other existent on RAD Studio, of course) you can use: "DEPLOYMENT" --> indicated for your case! because you want "indicate the "TARGET folder" OR.... I say "OR" add your files using "Project Manager" -- here, you cannot do it! So, you'll have two ways to do it!!! --> two independent ways !!! Using the "COMPILING EVENTS", it's for anothers tasks... but it's possible adapt it!!!! the compiler/linker can execute anothers "commands" before, pre, or after actions! then, you would can, for example, execute a ".BAT" file/EXE/COM/VBS/etc... to execute any task before/pre/after your building... you see? --> I think that it's not your case here! Edited December 11, 2022 by programmerdelphi2k Share this post Link to post
PeterBelow 238 Posted December 11, 2022 11 hours ago, Jeff Steinkamp said: I've dropped those files into the project manager. I see nothing that resembles the Deployment screen you show above. I get this: But, at this stage of the game I'm not even close to project deployment, I am barely into the development phase. But I do need these files in the output folder for continued development. I'm not sure exactly how the build events are helpful unless there are some commands that can be used to copy these files during the pre-build event. Build events allow you to execute shell commands, like "copy" or "rename", using macros that get replaced with project related pathes etc.. Since the files are used by the finished program I would use the post build event for that. The deployment stuff is for non-Windows targets only if I understood that correctly. Share this post Link to post
programmerdelphi2k 237 Posted December 11, 2022 (edited) 2 hours ago, PeterBelow said: The deployment stuff is for non-Windows targets only if I understood that correctly. You misunderstood! after build your project, just use "Deployment" "button" to deploy your project+any files on setup Edited December 11, 2022 by programmerdelphi2k Share this post Link to post
programmerdelphi2k 237 Posted December 11, 2022 (edited) here my sample to MSWindows, but works in any other platform where PAServer works! Install your PAServer in your MSWindows (same PC or PC target - does not matter, since the the PC can be seen by RAD IDE, or be, same network!!! "setup_paserver.exe" is in: C:\<<installation-dir>>\PAServer on PAServer command line type: paserver -unrestricted -scratchdir=<<d:\MyNewScratchDirToPAServerDeployment>> // it's ready! here it's where your new project + files will be placed run it and go back to RAD IDE! config your "Deployment" setup as above, indicating what files you need deploy together with your exe/dll now, build your project now, in "Deployment", just click "Deploy" button... as you dont have your "profile" created, the IDE ask to create it... then do it now! give a name, inform the IP where PAServer is running + password if used ... test connection! it's ready! NOTE: PAServer show the IP/Port using command "i" and "p" in your console! Edited December 11, 2022 by programmerdelphi2k Share this post Link to post
Rollo62 536 Posted December 11, 2022 (edited) Not exactly clear what you are looking for, but you can also use Resources to include files Its possible to load them to ResourceStream like that. procedure TForm1.Button1Click(Sender: TObject); var List: TStringList; Stream: TResourceStream; begin Stream := TResourceStream.Create(HInstance, '<Resource identifier>', RT_RCDATA); try List := TStringList.Create; try List.LoadFromStream(Stream); Label1.Text := List.Text; finally List.Free; end; finally Stream.Free; end; end; But these were fixed files, not user-loadable via dialog in the app. Edited December 11, 2022 by Rollo62 Share this post Link to post
programmerdelphi2k 237 Posted December 11, 2022 (edited) @Rollo62 what he want is: transfer the 4 files (txt, cvs, scripts at general) to target app-folder to use it "on future"! not just have the "data" into app!!! like as: "Please, sir RADStudio copy my files xxxx, because I want use it later in my app"... 🙂 Edited December 11, 2022 by programmerdelphi2k Share this post Link to post
FPiette 383 Posted December 11, 2022 Use post-build commands in your project options. Add the command to copy the required file to the destination folder. You have a bunch of macros to access many things. You can see the macros when you click the "..." to add post-build commands. For example $(OUTPUTDIR) in your command (such as copy) will be replaced by the actual output directory. 1 Share this post Link to post
Jeff Steinkamp 1 Posted December 17, 2022 Thanks for all of the suggestions and recommendations. I have chosen to use the post-build commands as this way those files in the output folder will always be updated in the event I have to make modifications to those files during the development process. Share this post Link to post
programmerdelphi2k 237 Posted December 18, 2022 (edited) using "Deployment" you has same! including when using PAServer all go together Edited December 18, 2022 by programmerdelphi2k Share this post Link to post