2

Has anyone got perforce windows client working with long file names? Following this article on Perforce KB I tried to use \?\C:\Temp as workspace root, but P4V gives error of the following form:

can't create directory for

\\?\C:\temp\path...

mkdir: \\?\C:\: Access is denied.

It seems to me that P4V is trying to create the directory \\\\?\\C:\\, having I assume decided that it does not exist.

My P4C client seems to be version "Rev. Perforce Visual Client/NTX86/2011.1/428988", of "2012 March 09"

Miserable Variable
  • 28,432
  • 15
  • 72
  • 133

2 Answers2

1

The knowledge base article you reference has to do with very long paths, not with long filenames (by which I think you mean more than the old DOS "8.3" filename length).

Since Perforce doesn't have a mkdir command, you should create a directory as you normally would under Windows, then edit a file in that directory.

At this point you haven't used Perforce at all.

You can then use P4V to "add" the file you just created to your Perforce tree, and "submit" the file when you're ready to enter it into the version control system.

Eric Miller
  • 1,944
  • 16
  • 12
  • The error is "file name too long" but I *think* the problem is with length of the path itself: initial checkout works if the workspace root is c:\x but not if it is c:\users\perforce\workspace\u6965_win7x88985_6431. With workspace root "\\?\C:\temp" the error is access error for mkdir for \\?\C:\ , which is why I think P4V does not understand the unc path. – Miserable Variable Apr 08 '13 at 20:39
  • The path you show is much shorter than the 260 byte path limit addressed by the KB article. How long is the name of the file you're trying to check in? (does that length + the length of the path you show above go beyond 260 bytes?). BTW, I'd be a little put off by the KB article's wording about using \\?\: "Prepend \\?\ to the existing file name (This method is unverified..." Perforce hints strongly in that article that they prefer using subst. – Eric Miller Apr 08 '13 at 21:19
  • The workspace root is not itself > 260 characters, but the file on which I get error has total length > 260 chars. BTW I am not trying to checkin, I am trying to setup my workspace and getting all the files initially from the server (depot?). I apologize for wring terminology use, I am quite new to perforce. – Miserable Variable Apr 08 '13 at 21:23
  • OK, I understand. Can you use subst to map your top-level path to a drive name, (maybe P: for "Perforce" or something like that)? I know some IT depts like to limit users' ability to do that sort of thing. The KB article hints that Perforce recommends that over \\?\. – Eric Miller Apr 08 '13 at 21:36
  • Yes, I am using a substituted drive as the workspace root, mapping `c:\users\\perforce` to `S:`. For whatever reasons, my workspace names are quire long; initially I used `S:\long-workspace-name` as root and still hit the pathname lenght limit so now I am using `S:\` as workspace root. This gives me 30 more characters in path length but I am looking for a solution with which I can use pathnames longer than that. – Miserable Variable Apr 08 '13 at 23:37
  • A Perforce client isn't limited to a one-to-one mapping from the Perforce tree into your local directory tree, so if your tree has relatively few branches that exceed the 260 byte limit, you might be able to map the longer paths to their own drive letters. In you client view, you probably have something that maps //depot/path-to-head/... to P:\... Instead, you can map //depot/path-to-head/long-path-1/... to P:\L1\... and //depot/path-to-head/long/path-2/... to P:\L2\..., or instead of P:\L1 and P:\L2, use Q:\ and R:\. This isn't a beautiful solution, but 300 character paths are nasty too. – Eric Miller Apr 09 '13 at 11:07
  • Besides mapping long paths, I will also have to map `//depot/path-to-head` to `P:\` and *exclude* `//depot/path-to-head/{long-path-1,long-path-1}` for the rest of the project, i.e. `//depot/path-to-head/short-path1` etc. I am new to OSGi/Maven environment but long path names seem to be the norm so I really don't think 300 characters is nasty – Miserable Variable Apr 09 '13 at 17:36
1

In my case "The file name is too long" was due to a long path name.
I guess the error message is not so clear. It’s related to a Windows file system limitations.

My solution was to remove few characters from the work-space name. I guess this is a short term solution.
The following KB article discusses different workarounds to this issue.

I am using:

  • Windows 7 (Version 6.1.7601)
  • P4V version: Perforce Visual Client/NTX64/2012.2/527787
Haim Raman
  • 11,508
  • 6
  • 44
  • 70