Current xaml path


#1

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.


#2

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


#3

I neeed the path during runtime.


#4

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


#5

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.


#6

Hi @akhi_s27,

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

This will give you the path of the xaml.

Regards,
V


#7

Vikas,

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


#8

Ah Ok.

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

Regards,
V


#9

Hello!

Try to use: System.IO.Directory.GetCurrentDirectory

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

Regards,


#10

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.