How do I create then use long Windows paths from Perl?

前端 未结 5 1458
南笙
南笙 2020-12-05 15:01

I have part of a build process that creates a hideously long paths in Windows. It\'s not my fault. It\'s several directories deep, and none of the directory names are abnorm

5条回答
  •  囚心锁ツ
    2020-12-05 15:03

    I understand this is not a solution to your specific problem. However, there are a lot of scenarios where being able to map a very long path to a drive-letter would allow one to sidestep the issue and would therefore be useful in dealing with very long path names without having to wade through a whole lot of Windows specific code and docs.

    Despite all the effort I put into figuring out how to do this, I am going to recommend somehow using SUBST. Win32::FileOp provides Subst and Unsubst. You can then map the top level working directory to an unused drive letter (which you can find by using Substed). I would start checking with Z and working backwards.

    Or, you can shell out, invoke subst utility with no parameters to get a list of current substitutions, choose one that is not there.

    None of this is entirely safe as substitutions could change during the build process.

提交回复
热议问题