I retrieve path names using the File::Find module, and "windowsify"
the paths by changing

/cygdrive/f   --> F:   and  / --> \\

globally.  What more do I have to do to make it work?

My actual code was similar to this:
#!/usr/bin/perl -w
use File::Find;
use Win32::Shortcut;
sub wanted {
  return unless /\.lnk$/i;
  my $winname = $File::Find::name;
  $winname =~ s{^/cygdrive/f/}{F:\\};
  $winname =~ s{/}{\\}g;
  my $LINK = new File::Find::Shortcut($winname)
    or do{warn "Could not find '$winname'.\n"; return};
  $LINK->{'Path'} =~ s{^C:\\Documents and settings\\blah\\My Pictures\
\}{F:\\Blah Pictures\\}
    and $LINK->Save();
}
File::Find::find(\&wanted, "/cygdrive/f");

The script fixes shortcuts after moving a folder hierarchy to a new
drive. It works for shortcuts having ascii-only names.

I suspect the problem is related to this call in the module source
file Shortcut.xs:498:
MultiByteToWideChar(CP_ACP, 0, filename, -1, (wchar_t *)wfilename,
MAX_PATH);

I suspect that CP_ACP, the "ansi" codepage, mangles 8-bit codes
somehow.

Reply via email to