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

isGzipped return TRUE for non-existing file #67

Open
xhdong-umd opened this issue Mar 1, 2017 · 2 comments
Open

isGzipped return TRUE for non-existing file #67

xhdong-umd opened this issue Mar 1, 2017 · 2 comments

Comments

@xhdong-umd
Copy link

Running examples in compressFile:

cat(file="foo.txt", "Hello world!")
print(isGzipped("foo.txt"))
print(isGzipped("foo.txt.gz"))

Note the foo.txt.gz is not exist yet but isGzipped returned TRUE. Further test prove that it will return TRUE for any file name with gz even it doesn't exist.

isGzipped("test.gz")

> sessionInfo()
R version 3.3.2 (2016-10-31)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: macOS Sierra 10.12.2

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] R.utils_2.5.0     R.oo_1.21.0       R.methodsS3_1.7.1

loaded via a namespace (and not attached):
 [1] htmlwidgets_0.8 magrittr_1.5    profvis_0.3.3   htmltools_0.3.5 tools_3.3.2     Rcpp_0.12.9     stringi_1.1.2  
 [8] knitr_1.15.1    stringr_1.2.0   digest_0.6.12  
@xhdong-umd
Copy link
Author

From the source code, looks like it is checking from file extension only sometimes. The function name and the help made me to expect the file at least need to be exist, or it should always check by content.

HenrikBengtsson added a commit that referenced this issue Oct 19, 2017
@HenrikBengtsson
Copy link
Owner

Thanks for this. I've now clarified in the help that the file does indeed not need to exist (when `method = "extension"; the default).

I could look into the possibility of returning isFile(x) || .... However, that's major work, because it will require lots of rev dep checks. It could be that some code somewhere is relying on isGzipped() to test the filename extension regardless of the file existing or not.

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

No branches or pull requests

2 participants