Create link to folder that is in the project

This forum can be browsed by the general public. Posting is limited to current SAPIEN license holders with active maintenance and does not offer a response time guarantee.
Forum rules
DO NOT POST LICENSE NUMBERS, ACTIVATION KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 5 years and 3 weeks old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
User avatar
GHIsolierung
Posts: 62
Last visit: Tue Nov 02, 2021 12:46 am

Create link to folder that is in the project

Post by GHIsolierung »

Powershell Studio 2019 64 bit Version 5.6.157
Windows 10 64bit 1803

Hello,
I have created a module folder within my Forms project from which a module can be loaded if required.
SAPIEN PowerShell Studio 2019 2019-03-01 09.39.42.png
SAPIEN PowerShell Studio 2019 2019-03-01 09.39.42.png (9.45 KiB) Viewed 2035 times
I don't know how to
a) programmatically access the folder when I am in Powershell Studio, and
b) later when I have compiled the project into an exe file.
If the program is started later, the execution location might be C:\, if I run it now, the execution location might be ..\Documents\Projects...

So how can I create a stable link to this module folder within my Project / *.exe?
Thank you for your help

EDIT: I was able to explain it to myself somehow,
within the project I can simply dot-sourcing to the folder.
When I create a *.exe file from the project, I have to make the folder available in the target by copying it there.
When creating a *.msi file, do you use the staging folder to provide data?
correct?
User avatar
davidc
Posts: 5913
Last visit: Mon Jul 08, 2019 8:55 am
Been upvoted: 2 times

Re: Create link to folder that is in the project

Post by davidc »

Yes, dot sourcing will work. There is also a Get-ScriptDirectory helper function included in the Globals.ps1 file that returns the path of the script or executable.

The MSI can recreate the folder and files. If the folder's content is part of the project and the folder's project files' Build properties is set to Content, it will be automatically included in the MSI.
Build Property Content.png
Build Property Content.png (12.69 KiB) Viewed 1999 times

Alternatively, you can create a staging folder and manually manage the folder contents.
David
SAPIEN Technologies, Inc.
User avatar
GHIsolierung
Posts: 62
Last visit: Tue Nov 02, 2021 12:46 am

Re: Create link to folder that is in the project

Post by GHIsolierung »

thanks David
This topic is 5 years and 3 weeks old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.