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

  • SEARCH
  • Home
  • 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 8717175
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T06:15:04+00:00 2026-06-13T06:15:04+00:00

PathAppend is a useful winapi function that lets you append one path to another

  • 0

PathAppend is a useful winapi function that lets you append one path to another while taking care of any trailing backslashes (or lack of them).

Meaning that appending "/dir1" to "dir2", or "/dir1" to "/dir2", or "/dir1/" to "/dir2" would produce the same (correct) result – "/dir1/dir2" (while simply concatening would produce respectively "/dir1dir2", "/dir1/dir2", and "/dir1//dir2").

Is there any Qt function that does a similar thing?

  • 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-13T06:15:05+00:00Added an answer on June 13, 2026 at 6:15 am

    There is not that function but QDir::cleanPath() will handle everything you need, you just have to concatenate paths:

    QString appendPath(const QString& path1, const QString& path2)
    {
        return QDir::cleanPath(path1 + QDir::separator() + path2);
    }
    

    I used QDir::separator() instead of raw “/” but it’s not mandatory because QT internally translate that separator to the native one (if needed, see Cross-platform way of constructing an FS path with Qt).

    Note that (for whom with a .NET background) there is another similar function: Path.Combine(), it behaves somehow similar to PathAppend() but it’s different. See Is there a QPath::Combine()? for a QT emulation of its behavior (and for a slightly more detailed outlining of their differences).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

import sys sys.path.append('/home/myuser/svn-repos/myproject') from myproject.settings import * But, it says module not found when
I have following code: os.chdir(os.path.dirname(os.path.realpath(__file__)) + /../test) path.append(os.getcwd()) os.chdir(os.path.dirname(os.path.realpath(__file__))) Which should add /../test to
So I have a main.py file inside /home/richard/projects/hello-python directory: import sys sys.path.append('/home/richard/projects/hello-python') from Encode
Firstly, here's my script: #!/usr/bin/python import sys, os sys.path.append('/home/username/python') sys.path.append(/home/username/python/flup) sys.path.append(/home/username/python/django) # more path
C programming, are there any good ways to manage path strings rather than using
Whenever I use sys.path.append , the new directory will be added. However, once I
I thought import sys sys.path.append(/home/me/mydir) is appending a dir to my pythonpath if I
I have the following simple code: import urllib2 import sys sys.path.append('../BeautifulSoup/BeautifulSoup-3.1.0.1') from BeautifulSoup import
I know that I can add an import path to Python like this: import
I have a python script that is trying to import another script somewhere in

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.