Autoloader - app.bundle home folder

Autoloader - app.bundle home folder

vladimir_michl
Advisor Advisor
1,242 Views
5 Replies
Message 1 of 6

Autoloader - app.bundle home folder

vladimir_michl
Advisor
Advisor

Is there a way how to find which directory is the app loaded from? I need a way to point to a specific file in the application's own .bundle folder structure - e.g. to start a specific .exe with (startapp) from the CUI menu macro.

 

Vladimir Michl

 

0 Likes
1,243 Views
5 Replies
Replies (5)
Message 2 of 6

redtransitconsultants
Collaborator
Collaborator

It's one of these 3 locations...

 

C:\Users\%username%\AppData\Roaming\Autodesk\ApplicationPlugins

 

C:\Program Files\Autodesk\ApplicationPlugins

 

C:\ProgramData\Autodesk\ApplicationPlugins

 

 

 

But if you're looking to do it from the code file within CAD, you'll need to do a reflection on the source file. Fairly easy to do in .NET not sure for LISP

Steve Hill,Civil Designer / .NET Developer / AutoCAD and AutoCAD Civil 3D Certified Professional
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature

http://redtransitconsultants.com/
Autodesk Exchange Store
Twitter | LinkedIn | YouTube

0 Likes
Message 3 of 6

vladimir_michl
Advisor
Advisor

Thanks,

I was thinking of some kind of variable (e.g. in the XML manifest file) saying "I'm sitting here". Another option would be to check all three possible locations.

 

Vladimir Michl

 

0 Likes
Message 4 of 6

redtransitconsultants
Collaborator
Collaborator

I'm not sure you can do it in XML coding, even then if you could, how would you store that to call it up in a CUI button? I'm not sure that would work.

 

For .NET, it's simply:

 

public static string AssemblyDirectory
{
    get
    {
        string codeBase = Assembly.GetExecutingAssembly().CodeBase;
        UriBuilder uri = new UriBuilder(codeBase);
        string path = Uri.UnescapeDataString(uri.Path);
        return Path.GetDirectoryName(path);
    }
}

 

But if you don't know where it's stored and just looking to create a CUIx button to tell you where it is... then need to have a macro that can check for a file in those 3 locations. I'm not positive that can be done as I've never tried.

 

 

Steve Hill,Civil Designer / .NET Developer / AutoCAD and AutoCAD Civil 3D Certified Professional
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature

http://redtransitconsultants.com/
Autodesk Exchange Store
Twitter | LinkedIn | YouTube

0 Likes
Message 5 of 6

Alexander.Rivilis
Mentor
Mentor

Variant:

(vl-filename-directory (findfile "<name>.cuix")) 

Oops. It is a bad idea. Sorry...

Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням! | Do you find the posts helpful? "LIKE" these posts!
Находите сообщения полезными? Поставьте "НРАВИТСЯ" этим сообщениям!
На ваше запитання відповіли? Натисніть кнопку "ПРИЙНЯТИ РІШЕННЯ" | Have your question been answered successfully? Click "ACCEPT SOLUTION" button.
На ваш вопрос успешно ответили? Нажмите кнопку "УТВЕРДИТЬ РЕШЕНИЕ"


Alexander Rivilis / Александр Ривилис / Олександр Рівіліс
Programmer & Teacher & Helper / Программист - Учитель - Помощник / Програміст - вчитель - помічник
Facebook | Twitter | LinkedIn
Expert Elite Member

0 Likes
Message 6 of 6

vladimir_michl
Advisor
Advisor

This is what I have tried also. Unfortunately the "home" folder is not in the search path (and adding it would be a chicken-egg problem). I wish there was a mechanism for this as it is quite usual to access individual files from the app folder structure - EXEs, preconfigurations, resources...

 

Vladimir Michl, www.cadstudio.cz  www.cadforum.cz

 

0 Likes