Questions tagged [path-combine]

System.IO.Path.Combine is a .NET method to combine two (or more) strings into a path.

System.IO.Path.Combine is a .NET method to combine two (or more) strings into a path.

21 questions
19
votes
2 answers

Why Path.Combine doesn't add the Path.DirectorySeparatorChar after the drive designator?

var actual = Path.Combine("c:", "filename"); var expected = @"c:\filename"; Assert.AreEqual(expected, actual); Result {Assert.AreEqual failed. Expected:. Actual:. Why?
Jader Dias
  • 88,211
  • 155
  • 421
  • 625
12
votes
2 answers

Resolving relative paths with wildcards in C#

In C#, if I have a directory path and a relative file path with wildcard, e.g. "c:\foo\bar" and "..\blah\*.cpp" Is there a simple way to get the list of absolute file paths? e.g. { "c:\foo\blah\a.cpp", "c:\foo\blah\b.cpp" } Background There is a…
NS.X.
  • 2,072
  • 5
  • 28
  • 55
5
votes
3 answers

System.ArgumentException illegal characters in path

I am using Path.Combine, and one of the strings contain a Unicode characters. I get {System.ArgumentException} exception; illegal characters in path. According to MSDN filepath/name can have unicode characters. Why do I get this…
MOZILLA
  • 5,862
  • 14
  • 53
  • 59
4
votes
2 answers

Is there a .NET API to return the equivalent extended-path string of a given path?

In NTFS, I can prefix a path with the \\?\ character sequence to denote that it is a path that exceeds the 260-character limit; as such, the file system will interpret the path correctly and avoid raising PathTooLongException. (see…
Steve Guidi
  • 19,700
  • 9
  • 74
  • 90
2
votes
3 answers

Path.Combine not working when combining remote server path with a file path

From an ASP.NET MVC app I am trying to concatenate two paths, a remote server path with a path extracted from database. I am performing below: string serverPath = @"\\myServer\TempFolder"; string filePath = GetPathFromDatabaseTable(); string…
Willy
  • 9,848
  • 22
  • 141
  • 284
2
votes
2 answers

Saving file into Path.Combine directory

Could someone advise of how can I save a file into Path.Combine directory? Please find some of my code below. Creation of directory: string wholesalePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), mainFolder,…
A.Rosso
  • 77
  • 3
  • 11
2
votes
3 answers

How do I combine_first, indexing specific column two DataFrames into one?

After mapping by column c, If column A has a value, insert the value of column A; if not, insert column B. data1 data2 a b c a c d a1 b1 c1 1a c1 1d …
susim
  • 221
  • 5
  • 15
2
votes
2 answers

Java algorithm to "multiply" two lists of lists ((A),(B))*((C,C),(D,D))==((A,C,C),(A,D,D),(B,C,C),(B,D,D))

I have two lists of lists, the sublists represent paths. I want to find all paths. List> pathList1 List> pathList2 The naive solution of course: List> result = new ArrayList>(); for(List p1 : pathList1) { …
user498001
  • 244
  • 1
  • 6
1
vote
0 answers

Directory Traversal Attack in c# for Path.Combine

I have a Rest Service which is inputs as parameters.Inside that there is a Path.Combine method which is used to generate a path.But in veracode it catch Path.Combine method for Directory Traversal Injection. Any possible ways to fix the issue. var…
LahiruD
  • 93
  • 1
  • 12
1
vote
0 answers

Error 404 Not Found Minify

I try using minify version 2.1.3(old), because last version not working, when i try combine 3 js and refresh website, it's write 404 not found, i already try follow instruction from this youtube [ Minify ] Improving Performance - Part 2 but still…
Newbi
  • 99
  • 1
  • 9
1
vote
1 answer

Why is this string being mysteriously modified?

Please forgive me if the answer to this is simple, but I have NO idea what is causing this. The PathCombineA function is somehow modifying the mypath variable. If you run the program you will see what I mean. (You must link Shlwapi.lib) #include…
43.52.4D.
  • 950
  • 6
  • 14
  • 28
1
vote
4 answers

Access to path is denied

for some reason when I create my path that will be used for my StreamWriter it creates a folder called test.doc instead of a file called test.doc Here is my code: fileLocation =…
Pallas
  • 1,499
  • 5
  • 25
  • 57
0
votes
1 answer

Error when trying to read a file via relative path in .net core 3.X in production

When I'm running my project in localhost I'm able to locate the file and process it further. This is achieved with this line of code. path = Path.Combine(Directory.GetCurrentDirectory(), "EmailTemplates\\SuccessOrderWindows10.html"); I'm able to…
Csibi Norbert
  • 780
  • 1
  • 11
  • 35
0
votes
1 answer

Error when trying to read a file via relative path in .net core 3.X in production

When I'm running my project in localhost I'm able to locate the file and process it further. This is achieved with this line of code. path = Path.Combine(Directory.GetCurrentDirectory(), "EmailTemplates\\SuccessOrderWindows10.html"); I'm able to…
Csibi Norbert
  • 780
  • 1
  • 11
  • 35
0
votes
1 answer

Take all text files in a folder and combine then into 1

I'm trying to merge all my text files into one file. The problem I am having is that the file names are based on data previously captured in my app. I don't know how to define my path to where the text files are, maybe. I keep getting a error, but…
Simeon EM
  • 1
  • 6
1
2