How to find the latest the ThreadData folder on all platforms?

How to find the latest the ThreadData folder on all platforms?

thomasa88
Advocate Advocate
46 Views
2 Replies
Message 1 of 3

How to find the latest the ThreadData folder on all platforms?

thomasa88
Advocate
Advocate

I have created the add-in ThreadKeeper, which copies threads into Fusion's ThreadData folder every time Fusion is updated.

 

I have previously based the look-up on app.userInterface.workspaces.itemById('FusionSolidEnvironment').resourceFolder to find webdeploy/production/<hash>/...../ThreadData, but I have now hit a use-case where this method fails. The problem happens on a Mac.

The resourceFolder is

 

/Applications/Autodesk Fusion.app/Contents/Libraries/Applications/Fusion/Fusion/UI/FusionUI/Resources/Environment/Model ,

 

while the user's ThreadData folder is 

 

/Users/<user>/Library/Application Support/Autodesk/webdeploy/production/<letters and numbers>/Autodesk Fusion.app/Contents/Libraries/Applications/Fusion/Fusion/Server/Fusion/Configuration/


What is the best way to look up the ThreadData folder?

I asked the user for the paths in Application.applicationFolders and the text command "paths.get", but none contains when webdeploy path.

0 Likes
47 Views
2 Replies
Replies (2)
Message 2 of 3

thomasa88
Advocate
Advocate

I may have figured out two hacky ways that seem to work on Windows. I will ask the user to test them on Mac.

sys.argv[0] 
C:\\Users\\Thomas\\AppData\\Local\\Autodesk\\webdeploy\\production\\ca305acf3852cfce8e837ee5435adf649bc398ca\\Fusion360.exe

sys.executable 
C:/Users/Thomas/AppData/Local/Autodesk/webdeploy/production/ca305acf3852cfce8e837ee5435adf649bc398ca/Python\\python
0 Likes
Message 3 of 3

Jorge_Jaramillo
Collaborator
Collaborator

Hi,

 

This code snipped based on the 'paths.get' text command works for me in windows:

import json
import adsk
import adsk.core
import adsk.fusion

app = adsk.core.Application.get()

def run(context) -> None:
    try:
        paths: dict[str, str] = json.loads(app.executeTextCommand('paths.get'))
        app.log(f'rootDirectory: {paths["rootDirectory"]}')
    except Exception:
        app.log('Failed:\n{}'.format(traceback.format_exc()))
    adsk.terminate()

 

It produces the following output:

rootDirectory: C:/Users/<username>/AppData/Local/Autodesk/webdeploy/production/ca305acf3852cfce8e837ee5435adf649bc398ca/

 

Then you can append "Fusion/Server/Fusion/Configuration/ThreadData" to get the full directory path.

 

I don't have a Mac environment to test it over there, but I'd expect the result is the same.

 

Regards,

Jorge Jaramillo

 

0 Likes