When I publish a project uipath does respect the original system.Environment.CurrentDirectory

I think there is an error at the moment to publish a project because I configured my flow to get the project directory (system.Environment.CurrentDirectory) and save there images and other documents.

However, when I publish the project and execute using uirobot the system.Environment.CurrentDirectory is changed to “C:\ProgramData\UiPath\Projects\FlowMain\lib\net45” which
cause that the flow does not work because that path doesnt have the directories where I save the images needs.

For me the best practice will be keep the original system.Environment.CurrentDirectory that is the directory where the flow was developed and not the directory where the project is published.

CurrentDirectory isn’t the most reliable way to retrieve the working directory - it’s the current working directory. That means it will change if any component changes the directory - and that could be a simple file read operation.

There is nothing wrong with using relative paths, by the way - this example points to a file inside the Content folder of the current project’s directory: .\Content\10000-row-challenge.xlsx