I know that GetCurrentDirectory() and SetCurrentDirectory() functions exist on the MFC framework, but I don't have a CFtpConnection object in my application. I have a simple CWinApp-derived class, and I would like to retrieve its working directory upon program startup. What's the easiest method to achieve this goal? Thanks in advance for the advices.
The current working directory means the root folder of your current Java project.
GetCurrentDirectory is a simple Win32 API function, so just call it like this:
TCHAR currentDir[MAX_PATH];
GetCurrentDirectory( MAX_PATH, currentDir );
I assume you are trying to get the directory where your .exe file is located instead of the current directory. This directory can be different from the current directory.
TCHAR buff[MAX_PATH];
memset(buff, 0, MAX_PATH);
::GetModuleFileName(NULL,buff,sizeof(buff));
CString strFolder = buff;
strFolder = strFolder.Left(strFolder.ReverseFind(_T('\\'))+1);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With