Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8638029
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T10:37:26+00:00 2026-06-12T10:37:26+00:00

In the .NET API for Windows Store Apps the Path class does not have

  • 0

In the .NET API for Windows Store Apps the Path class does not have the GetFullPath method. I need to normalize a path though, which was easy using GetFullPath. Does anyone know another method or external code that normalizes a path? What I mean with that is for example:

  • add the application’s path if the path does not start with a drive
  • handle ..\ and .\ correctly

GetFullPath is pretty complex and mimicking the functionality is not easy.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T10:37:27+00:00Added an answer on June 12, 2026 at 10:37 am

    I did not find any replacement for GetFullPath, but developed a method that handles parent directory tokens (..\) like GetFullPath.

    Here it is:

    public static string NormalizePath(string path)
    {
       if (String.IsNullOrEmpty(path) == false)
       {
          // Correct multiple backslashes
          path = Regex.Replace(path, @"\\+", @"\");
    
          // Correct parent directory tokens with too many points in it
          path = Regex.Replace(path, @"\\\.\.+", @"\..");
    
          // Split the path into tokens
          List<string> resultingPathTokens = new List<string>();
          var pathTokens = path.Split('\\');
    
          // Iterate through the tokens to process parent directory tokens
          foreach (var pathToken in pathTokens)
          {
             if (pathToken == "..")
             {
                if (resultingPathTokens.Count > 1)
                {
                   resultingPathTokens.RemoveAt(resultingPathTokens.Count - 1);
                }
             }
             else
             {
                resultingPathTokens.Add(pathToken);
             }
          }
    
          // Get the resulting path
          string resultingPath = String.Join("\\", resultingPathTokens);
    
          // Check if the path contains only two chars with a colon as the second
          if (resultingPath.Length == 2 && resultingPath[1] == ':')
          {
             // Add a backslash in this case
             resultingPath += "\\";
          }
    
          return resultingPath;
       }
       return path;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

BitmapSource does not have the Create method in the .NET API for Windows Store
CultureInfo.GetCultures does not exist in the .NET API for Windows Store apps. How could
I am trying to use the ASP.NET Web API Self-Host option with Windows authentication
So I am fairly new to ASP.NET MVC and Windows Live Connect API. Basically
Possible Duplicate: Windows API and .net languages I want to call native Windows API
I've recently started learning about .net and the Windows API and I'm currently writting
I have a Virtual Private Server running windows IIS hosing a startup site (.net
I have a .NET 3.5 Windows Service. I'm testing with a small application that
Is there is a best practices way to store credentials in a .NET Windows
Microsoft has a very nice Windows API wrapper included in .NET framework. It is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.