This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CCSv4 java script: How do I get the project directory path?

Hi

When I start the java console and type

print(env.getCurrentDirectory())

I get the output

C:\Program Files\Texas Instruments\ccsv4\eclipse

and

print(java.io.File(".").getCanonicalPath());

Gives me the output

C:\Program Files\Texas Instruments\ccsv4\eclipse

Can I use env or java.io to get the directory of my default project in the C/C++ Projects?


I'd like to know this so that I can set the java console directory path to the project for running scripts that use files in that directory to load variables.

So rather than giving "setCurrentDirectory" below an absolute path (as below),

env.setCurrentDirectory("d:/vws/Test/SpectralAvg/");

I'd like it derive the path from some fancy schmancy java command (or DSS command)

env.setCurrentDirectory("function_fancy_schmancy_goes_here");

Cheers

  • Eddie,

    You can use eclipse API to acheive what you needed. Thees two lines are a snippet that you can output the path for project arm9. You need to use the name of your project.

    importPackage(Packages.org.eclipse.core.resources)


    print(ResourcesPlugin.getWorkspace().getRoot().getProject("arm9").getLocation())

     

    Have fun with scripting.

    Regards,
    Patrick

  • Awesome!

     

    Thanks