question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

GetFileNameWithoutExtension return empty string on filename with no extension

See original GitHub issue

When calling ZlpPathHelper.GetFileNameWithoutExtension with a filename without extension, the function is returning an empty string.

The correct return value should be the whole filename, as it doesn’t contain extension.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
mircoboschicommented, Sep 25, 2015

I’ve found that i was running 1.0.0.6 version, that seems to expose this behaviour. Updating the library to 1.0.0.8 seems to fix the issue.

0reactions
UweKeimcommented, Sep 24, 2015

Sorry, I’ve tried again and still cannot confirm.

These three tests succeed:

var r = ZlpPathHelper.GetFileNameWithoutExtension(@"\\?\C:\Simulazioni\Albero\scratch_file.txt");
Assert.AreEqual(r, @"scratch_file");

r = ZlpPathHelper.GetFileNameWithoutExtension(@"\\?\C:\Simulazioni\Albero\scratch_file.");
Assert.AreEqual(r, @"scratch_file");

r = ZlpPathHelper.GetFileNameWithoutExtension(@"\\?\C:\Simulazioni\Albero\scratch_file");
Assert.AreEqual(r, @"scratch_file");
Read more comments on GitHub >

github_iconTop Results From Across the Web

Path.GetFileNameWithoutExtension Method (System.IO)
Returns the file name without the extension of a file path that is represented by a read-only character span. GetFileNameWithoutExtension(String).
Read more >
Remove file extension from a file name string
GetFileNameWithoutExtension method gives you the filename you pass as an argument without the extension, as should be obvious from the name.
Read more >
Get Filename without Extension in PowerShell [3 Ways]
To get filename without extension in powershell, you can use Get-Item cmdlet to get item at specified location and then use BaseName attribute...
Read more >
File::getFileNameWithoutExtension issue
It doesn't seem to work correctly if i have a path to a file that has no name. It gives me back the...
Read more >
How to Extract filename from a given path in C# - ...
This method is used to get the file name and extension of the specified path string. The returned value is null if the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found