Questions tagged [path-separator]

Questions on dealing with path separators in file systems, i.e. the delimiter symbol used by the file system for path components. The most commonly used path separators are the symbols '/' ("slash") and '\' ("backslash").

Questions on dealing with path separators in file systems, i.e. the delimiter symbol used by the file system for path components. The most commonly used path separators are the symbols '/' ("slash") and '\' ("backslash").

60 questions
615
votes
3 answers

When should I use File.separator and when File.pathSeparator?

In the File class there are two strings, separator and pathSeparator. What's the difference? When should I use one over the other?
icnhzabot
  • 9,801
  • 5
  • 21
  • 9
91
votes
11 answers

File path issues in R using Windows ("Hex digits in character string" error)

I run R on Windows, and have a csv file on the Desktop. I load it as follows, x<-read.csv("C:\Users\surfcat\Desktop\2006_dissimilarity.csv",header=TRUE) but the R gives the following error message Error: '\U' used without hex digits in character…
user297850
  • 7,705
  • 17
  • 54
  • 76
39
votes
4 answers

When to use DIRECTORY_SEPARATOR in PHP code?

require_once dirname(__FILE__).DIRECTORY_SEPARATOR . './../../../wp-config.php'; require_once dirname(__FILE__).DIRECTORY_SEPARATOR.'inc/options.php'; The above code is from a plugin from the Wordpress. I don't understand why half of it uses…
tanteng
  • 648
  • 1
  • 6
  • 11
31
votes
2 answers

File separators of Path name of ZipEntry?

ZIP entries store the full path name of the entry because (I'm sure of the next part) the ZIP archive is not organized as directories. The metadata contains the info about how files are supposed to be stored (inside directories). If I create a ZIP…
Ordiel
  • 2,442
  • 3
  • 36
  • 52
22
votes
3 answers

Get directory separator char on Windows? ('\', '/', etc.)

tl;dr: How do I ask Windows what the current directory separator character on the system is? Different versions of Windows seem to behave differently (e.g. \ and / both work on the English versions, ¥ is apparently on the Japanese version, ₩ is…
user541686
  • 205,094
  • 128
  • 528
  • 886
22
votes
3 answers

Why does the cmd.exe shell on Windows fail with paths using a forward-slash ('/'') path separator?

Just when I'd thought I'd seen it all with Windows path issues, I've now encountered a case that only fails when '/' (forward-slash) is used as the path separator is used: C:\temp\tcbugs>mkdir "dir1 with spaces" C:\temp\tcbugs>echo hi > "dir1 with…
Garen
  • 941
  • 2
  • 9
  • 20
19
votes
4 answers

Java's File.toString or Path.toString with a specific path separator

I am developing a Scala application on Windows, and I need to insert a path to a file into an HTML template. I use Java's io and nio to work with files and paths. /* The paths actually come from the environment. */ val includesPath =…
Malte Schwerhoff
  • 12,684
  • 4
  • 41
  • 71
16
votes
1 answer

Path separator char in python 2.4

Just out of curiosity - is there another way to obtain the platform's path separator char than os.path.normcase('/') in Python 2.4? I was expecting something like a os.path.separator constant...
Niklas
  • 5,736
  • 7
  • 35
  • 42
15
votes
3 answers

Is there QPath::Combine in QT4?

I need a similar to .NET method for safely combining path parts without worrying for platform specifics of the path separator. Is there such class and method in QT4? Something like: QPath::Combine
Gad D Lord
  • 6,620
  • 12
  • 60
  • 106
15
votes
1 answer

File.separator vs. File.pathSeparator

File has the static Strings separator and pathSeparator. The separator is a "default name-separator character" and the pathSeparator is a "path-separator character". What is the difference? Is there a time when one is preferable to the other?
Evorlor
  • 7,263
  • 17
  • 70
  • 141
5
votes
2 answers

python os.walk displays mixed windows and unix paths

I am trying to identify all files with certain names in a folder. I am using standard code to do that looking like this: for paths, subdirs, files in os.walk(start_dir, topdown=True): for file in files: print(os.path.join(paths,…
smoczyna
  • 489
  • 6
  • 18
5
votes
1 answer

How do I get the system's path separator with CMake

I'm configuring some project with CMake. I need to get the path separator (e.g. / or \) into a CMake variable to do something with in, never mind what exactly. How can I do that?
einpoklum
  • 118,144
  • 57
  • 340
  • 684
4
votes
3 answers

Joining filesystem paths in C

Similar to how python has the convenient os.path.join() function, I was wondering if there was a good cross-platform way to do this in C. My current approach is to set up some preprocessor directives with something like this #ifdef…
Scott Frazer
  • 2,145
  • 2
  • 23
  • 36
4
votes
4 answers

Get file separator in Fortran

Could you please tell me how to get the file separator of current operating system, for example \ in Windows and / in Unix, in Fortran at run-time.
4
votes
4 answers

Why do we need Application.PathSeparator?

MS Office VBA has a property called Application.PathSeparator. I'm supportive of interoperability, but Office runs only on Windows & MacOS, and both platforms use the same \ path separator. When would it ever be advisable to use…
ashleedawg
  • 20,365
  • 9
  • 72
  • 105
1
2 3 4