I'm updating my c# code and saw that the aaApi_GetWorkingDirectory function call is Deprecated and it said to use aaApi_GetUserStringSetting() instead.
so I switched my code to use the aaApi_GetUserString Setting to get the working directory but it only returns C and not the full path like the aaApi_GetWorking Directory did. below is my code. just wondering if I'm doing something wrong or not.
int AADMS_PAR = 100; int AADMS_PAR_WRK_WORKING_DIRECTORY = AADMS_PAR + 71; StringBuilder workDir = new StringBuilder(1024); bool result = PWWrappers.aaApi_GetUserStringSetting(AADMS_PAR_WRK_WORKING_DIRECTORY, workDir, 1024); //workDir is equal to c which is not correct IntPtr workingDir = PWWrappers.aaApi_GetWorkingDirectory(); string workingDirValue = Marshal.PtrToStringUni(workingDir); //workingDirValue is equal to c:\PW_working\pwise_odot\jdrsek\
any suggestions??
forgot to post the wrappers, which then made me see that I forgot the CharSet = CharSet.Unicode in the wrapper which is why I was only getting C and no the full path.
dumb mistake but hopefully it will help someone. below are the correct wrappers
[DllImport("c:\\Program Files\\Bentley\\ProjectWise\\bin\\dmscli.dll", CharSet = CharSet.Unicode)] public static extern IntPtr aaApi_GetWorkingDirectory(); [DllImport("c:\\Program Files\\Bentley\\ProjectWise\\bin\\dmscli.dll", CharSet = CharSet.Unicode)] public static extern bool aaApi_GetUserStringSetting(int lParam, StringBuilder lptstrParam, int lParamLength);
Answer Verified By: John Drsek