Current xaml path

How to access the path of the xaml being executed.
the Environment.CurrentDirectory gives the current execution base path.
But i need the path tof the xaml being executed.

1 Like

Hi,
Do you need the path of XAML in run time or Do you need to know where XAML is saved while developing?
Regards
V

I neeed the path during runtime.

@badita @alex.stoian
I am still stuck at this :worried:

Could you please explain your use-case? Why you need the path and what you are trying to achieve? Maybe we find an workaround.

Not straightforward (requires a bit of coding) but…you start in Environment.GetCurrentDirectory with Main.xaml, let’s say. Any path change will require an Invoke Workflow (wfPath). Therefore by concatenating the currentDirectory with wfPath - use Path.Combine - you’ll be able to get the current physical location of the running xaml.

4 Likes

Hi @akhi_s27,

Can you try using “system.appdomain.currentdomain.BaseDirectory”

This will give you the path of the xaml.

Regards,
V

Vikas,

For me System.Appdomain.Currentdomain.BaseDirectory returns the installation folder of UiPath: C:\Program Files (x86)\UiPath Studio\ !?

Ah Ok.

I used another one CurDir and it seems to be working, Please check and confirm?

Regards,
V

Hello!

Try to use: System.IO.Directory.GetCurrentDirectory

It will return the full path of the XAML Directory :wink:

Regards,

2 Likes

Just as a sidenote - Environment.CurrentDirectory (property) actually calls Directory.GetCurrentDirectory for Get, and Directory.SetCurrentDirectory for Set operation.

It’s quite an interesting situation actually :slight_smile: Either way, both will return same value and should work for this use case.

1 Like

Hi guys, does anyone got a solution for that?

I need this because i’m facing the following situation:

I’ve got a robot X with all its modules contained on its folder, with eventually will call another modules which are also on the same folder. This is fine cause I can pass the relative path to the “Invoke Workflow” activity and everything will run fine.

The deal is, I want my robot X to be able to run by itself and to be called by another Top-Level robots, which will be on another folder.

Thus, I wanted to use Invoke Workflow something like CurrentDirectory + ModuleName.xaml so the robot X will always work independently if it is running by itself or called by another robot.

If I use Directory.GetCurrentDirectory, it will return the Top Level robot directory within robot X, when it calls it.