xdg wrote:
CSIDL_LOCAL_APPDATA is a subroutine. So you've got to call it to return the right numeric flag for GetFolderPath.
$realhome = Win32::GetFolderPath( CSIDL_LOCAL_APPDATA() );
Revising the relevant code per your suggestion ...
if ($^O eq 'MSWin32') {
require Win32;
import qw(CSIDL_LOCAL_APPDATA);
$realhome = Win32::GetFolderPath( CSIDL_LOCAL_APPDATA() );
}
... I now get this error:
Undefined subroutine &main::CSIDL_LOCAL_APPDATA called at import.pl li
+ne 11.
jimk
Update:Or, from the command-prompt:
F:\AAAother\data>perl -MExporter -e "require Win32; Exporter::import '
+CSIDL_LOCAL_APPDATA'; print Win32::GetFolderPath( CSIDL_LOCAL_APPDATA
+() );"
Undefined subroutine &main::CSIDL_LOCAL_APPDATA called at -e line 1.
Further update:I just consulted the MS documentation, which provides 0x001c as the hex numerical value for CSIDL_LOCAL_APPDATA (). Substituting that into the previous code (and simplifying a bit), I get:
if ($^O eq 'MSWin32') {
require Win32;
print Win32::GetFolderPath( 0x001c ), "\n";
}
... which DWIMs on my system as:
C:\Documents and Settings\kbuser\Local Settings\Application Data
(Big sigh of relief!) Now, let's see if it works in the application from which all of the foregoing is excerpted. Thanks for your help.
jimk
Yet another update:Although the path listed immediately above is the return value generated by GetFolderPath (both in my implementation and in that suggested later by xdg), no such path could be found on my system, at least not through Windows Explorer/My Computer. That's because the directory level 'Local Settings' is absent. In order to get my application to work, I had to do the following (done from memory, so I don't guarantee it):
$realhome = Win32::GetFolderPath( CSIDL_LOCAL_APPDATA() );
$realhome =~ s|(.*?)\\Local Settings(.*)|$1$2|;
|