You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hallo,
I am not sure if this is a bug or something that is done on purpose. The file path does not appear to be case sensative. For example, both of these work. The file path on the one is without a capital f for file and for the second one there is a capital F for file.
The paths are different, but they point to the same file. I'm on macOS, the behavior will be the same on Windows, but most likely different on Linux. Are you looking for the functionality that fs::path_real() provides?
Hallo,
Thanks. I was just using the here function to import a data file, as I normally do. I miss typed the file name, with a lower case and I was still able to get the same file. I was surprised that it worked.
In other words, my file with my data file stays the same but I am able to access it with a upper and lower case using the here function from my script.
The file with my data is the following: final_data
I can access the same data file with the two scripts below.
Yes, so if I do that then I get the data. Sorry I changed the file names but the concept works the same. The data file can be upper or lower case and I get the same data file.
Activity
krlmlr commentedon Oct 2, 2023
Thanks. The paths are different, but perhaps your file system is case-insensitive?
zaslove commentedon Oct 2, 2023
is there a way to make them case sensitive ...
zaslove commentedon Oct 2, 2023
thus the case sensitivity is not something that the here function catches?
krlmlr commentedon Oct 2, 2023
A small example:
Created on 2023-10-02 with reprex v2.0.2
The paths are different, but they point to the same file. I'm on macOS, the behavior will be the same on Windows, but most likely different on Linux. Are you looking for the functionality that
fs::path_real()provides?zaslove commentedon Oct 2, 2023
Hallo,
Thanks. I was just using the here function to import a data file, as I normally do. I miss typed the file name, with a lower case and I was still able to get the same file. I was surprised that it worked.
In other words, my file with my data file stays the same but I am able to access it with a upper and lower case using the here function from my script.
The file with my data is the following: final_data
I can access the same data file with the two scripts below.
df1 <- readRDS(here("final_data/xxx.RDS") )
df2 <- readRDS(here("Final_data/xxx.RDS") )
I hope this makes sense ...
krlmlr commentedon Oct 2, 2023
I think we're almost on the same page here. What happens if you ask
fs::path_real(here("final_data/xxx.RDS"))?zaslove commentedon Oct 2, 2023
Yes, so if I do that then I get the data. Sorry I changed the file names but the concept works the same. The data file can be upper or lower case and I get the same data file.
If I do this, then I get the data:
Here I get the same data. The fs::path_real is upper case but the path file is lower.
zaslove commentedon Oct 2, 2023
so what does this all mean :-)
krlmlr commentedon Oct 2, 2023
Sorry, I don't understand the question.
zaslove commentedon Oct 2, 2023
oh sorry. I was just wondering where this leaves the discussion. In the end, the path is not case sensitive but it accesses the same file?
krlmlr commentedon Oct 2, 2023
"a" != "A"fs::path_real(). Two different canonical paths point to different fileszaslove commentedon Oct 3, 2023
Many thanks!!