2019-07-25 11:36 AM - last edited on 2022-10-05 01:23 PM by Daniel Kassai
Solved! Go to Solution.
2019-07-25 11:21 PM
API_ProjectInfo projectInfo; ACAPI_Environment(APIEnv_ProjectID, &projectInfo, 0); if (projectInfo.location != nullptr) { IO::Path path; projectInfo.location->ToPath(&path); }The variable
2019-07-25 11:42 AM
2019-07-25 12:31 PM
API_ProjectInfo projectInfo = {}; GSErrCode err = ACAPI_Environment (APIEnv_ProjectID, &projectInfo); if (err != NoError) return GS::EmptyUniString; if (projectInfo.untitled) // not saved yet return GS::EmptyUniString; if (!projectInfo.teamwork) { GS::UniString directoryOfTheProjectStr; IO::Location projectLocation = *projectInfo.location; projectLocation.DeleteLastLocalName (); projectLocation.ToPath (&directoryOfTheProjectStr); return directoryOfTheProjectStr; }
2019-07-25 12:32 PM
IO::Location folderLoc; API_SpecFolderID specID = API_ApplicationFolderID; ACAPI_Environment(APIEnv_GetSpecFolderID, &specID, &folderLoc);
2019-07-25 02:32 PM
Tibor wrote:Tried, it gave a bunch of numbers instead of path..
You can use APIEnv_ProjectID method to get the current project info.API_ProjectInfo projectInfo = {}; GSErrCode err = ACAPI_Environment (APIEnv_ProjectID, &projectInfo); if (err != NoError) return GS::EmptyUniString; if (projectInfo.untitled) // not saved yet return GS::EmptyUniString; if (!projectInfo.teamwork) { GS::UniString directoryOfTheProjectStr; IO::Location projectLocation = *projectInfo.location; projectLocation.DeleteLastLocalName (); projectLocation.ToPath (&directoryOfTheProjectStr); return directoryOfTheProjectStr; }
GS::UniString GetCurDir(){ API_ProjectInfo pj={}; ACAPI_Environment(APIEnv_ProjectID, &pj); GS::UniString p=*pj.projectPath; ACAPI_WriteReport(“%s”,true,p); return p; }
2019-07-25 11:21 PM
API_ProjectInfo projectInfo; ACAPI_Environment(APIEnv_ProjectID, &projectInfo, 0); if (projectInfo.location != nullptr) { IO::Path path; projectInfo.location->ToPath(&path); }The variable
2019-07-26 10:27 AM
Tomer1 wrote:Your code is fine. What probably caused a problem is ACAPI_WriteReport. You can print GS::String and UniString directly without %s
. It doesn’t print it
API_ProjectInfo pj = {}; ACAPI_Environment(APIEnv_ProjectID, &pj); GS::UniString p = *pj.projectPath; GS::UniString n = *pj.projectName; ACAPI_WriteReport(p, true); ACAPI_WriteReport(n, true);
Ralph wrote:Tested. This code works.
working code sample
2019-07-28 09:24 AM