Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible (ugly) fix for Windows path length errors #19

Open
bandrewfox opened this issue Dec 17, 2015 · 2 comments
Open

Possible (ugly) fix for Windows path length errors #19

bandrewfox opened this issue Dec 17, 2015 · 2 comments
Assignees
Labels

Comments

@bandrewfox
Copy link

Due to the file/path name length limit in Windows, the getFirehouseData does not work for many downloads. This is a known issue in the documentation of RTCGAToolbox.

So, I grabbed the code and made an ugly fix which I haven't tested too much... but maybe someone else can take it from here? Also, it requires installing 7-zip. I have only tested this using the rnaseqv2 files and nothing else... But it does work nicely for me.

In getFirehouseData.R, after line 234, replace the "untar" and "rename" commands with this:

    if (length(fileList) == 1 & nchar(fileList) > 200) {
      ## in windows, need to use 7zip for long filenames (I don't know if 200 is the right limit - needs some testing to be sure!!)
      # should also somehow check if this is a windows platform and if 7zip is installed

      # clear out any previous tmp dirs
      unlink(c("tmp1", "tmp3"), recursive = T)

      system(paste("C:/Progra~1/7-Zip/7z e -otmp1", tcgafile))
      tmp2.long.tar = paste("tmp1/", list.files("tmp1", pattern="*.tar"), sep="")
      write(paste("renaming file", tmp2.long.tar, sep=""), stderr() )
      file.copy(from=tmp2.long.tar,to="tmp1/tmp2.tar")

      system("C:/Progra~1/7-Zip/7z e -otmp3 tmp1/tmp2.tar")
      tmp3.long.txt = paste("tmp3/", list.files("tmp3", pattern = searchName), sep="")
      if (length(tmp3.long.txt) != 1) {
        stop("Can't find output file")
      }
      file.rename(from=tmp3.long.txt,to=destfile)
      unlink(c("tmp1", "tmp3"), recursive = T)

    } else {
      untar(tcgafile,files=fileList)
      file.rename(from=fileList,to=destfile)
    }
@lwaldron
Copy link
Collaborator

Was reminded of this by someone in my lab having the problem... Mehmet, are you going to apply this fix?

@mksamur
Copy link
Owner

mksamur commented Apr 21, 2016

This is a good question with different components. :) I don't like the idea
of using external tools but I also don't like the problem. I think I'll
integrate this but I will also control it with a parameter. By default it
will be OFF even on Windows machine and users then can turn it on if they
force it.

On Thu, Jan 28, 2016 at 5:26 AM, Levi Waldron notifications@github.com
wrote:

Was reminded of this by someone in my lab having the problem... Mehmet,
are you going to apply this fix?


Reply to this email directly or view it on GitHub
#19 (comment)
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants