Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Japanese directory separators
Qt 6.11 is out! See what's new in the release blog

Japanese directory separators

Scheduled Pinned Locked Moved General and Desktop
5 Posts 2 Posters 2.8k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Moschops
    wrote on last edited by
    #1

    On Japanese (Windows) systems suffering from an unfortunate bug I only see on Windows that was introduced decades ago, it is unfortunately customary to use ¥ as the symbol for a directory separator.

    Having looked around, it looks like I may have to handle this transformation myself when needed to convert, for example:

    /home/user/example
    to
    ¥home¥user¥example

    (although maybe not quite like that, but with c:\ in it or something, because I understand this is a Windows ugliness from decades ago that just won't die, and other OSes never got suckered into it)

    I suspect (hope) this will typically be for display purposes.

    Unless anyone knows of a helpful QT function that can do this for me? (By which I don't mean a character replace function - I mean a way to present a QDir or QFile or QFileInfo or some other object, and get back whatever the path to that file/dir would look like on a system using locale XXX)

    Having done a bit of research, this does look like a legacy windows ugliness that hangs around these days for no other reason than people are used to it, which is sickening, but it is what it is.

    I expect there is no QT built-in functionality for this, as that would have involved deliberately coding something to show the user something nonsensical just to fit in with a mistake made by a different company decades ago, but it's nice to check :)

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      Use "QDir::toNativeSeparators()":http://qt-project.org/doc/qt-5/qdir.html#toNativeSeparators

      (Z(:^

      1 Reply Last reply
      0
      • M Offline
        M Offline
        Moschops
        wrote on last edited by
        #3

        [quote author="sierdzio" date="1410946072"]Use "QDir::toNativeSeparators()":http://qt-project.org/doc/qt-5/qdir.html#toNativeSeparators[/quote]

        As far as I can tell from the documentation, that uses forward slash and backslash. it does not suffer from the Yen problem (and thus doesn't do what I want in this case)

        1 Reply Last reply
        0
        • sierdzioS Offline
          sierdzioS Offline
          sierdzio
          Moderators
          wrote on last edited by
          #4

          Try it before passing such judgement ;) I think you are right, but we may be wrong.

          (Z(:^

          1 Reply Last reply
          0
          • M Offline
            M Offline
            Moschops
            wrote on last edited by
            #5

            I've got a funny feeling that the code I have that produces the QString that is the path I need to fiddle with for display purposes already went through it anyway.

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved