Announcement

Collapse
No announcement yet.

wierd UpperCase/LowerCase behavior with MKDIR

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • wierd UpperCase/LowerCase behavior with MKDIR

    I am trying to create a directory with an all uppercase name.
    I cant do it with MKDIR. If all the charadters in the name are
    uppercase then the directory is made with the first character
    uppercase and the rest lowercase.

    However, If the LAST character in the dir name is lowercase, then
    the rest of the name WILL be uppercase !!??

    I am using:
    IF FldrExistsFlag = 0 THEN MKDIR ProgPathStr + SymbStr + PrefixStr

    where SymbStr and PrefixStr are all Uppercase

    and

    CALL GETMODULEFILENAME(BYVAL 0&, TmpAsciiz, SIZEOF(TmpAsciiz))
    ProgPathStr = LEFT$(TmpAsciiz, INSTR(-1, TmpAsciiz, "\"))

    Is this a windoze thing or a MKDIR "undocumented feature"



    ------------------
    Kind Regards
    Mike

  • #2
    What length are these file names? Windows implementation of mixed-case naming definitely has some quirks, but this could be a simple matter of 8.3 vs LFN naming.

    I'm 99.99999% sure that internally, PowerBASIC passes the file name to Windows without "adjusting" it in any way.

    ------------------
    Lance
    PowerBASIC Support
    mailto:[email protected][email protected]</A>
    Lance
    mailto:[email protected]

    Comment


    • #3
      The FOLDER (or directory) names are quite short for example

      ES_01H_FUT
      DK_01M_OPT
      AC_01Z

      In front of them is the path:

      C:\PBDLL60\OmegaResearch\Data&Apps\

      I have experimented more and it turns out that it only takes
      ONE lower case character to produce the correct case throughout
      the whole name.
      That character can be anywhere in the name!

      I wish I could be more creative with the names, but i need them
      to be all uppercase.

      Perhaps I could MKDIR then rename it and get it all uppercase that way?

      ------------------
      Kind Regards
      Mike



      [This message has been edited by Mike Trader (edited August 21, 2001).]

      Comment


      • #4
        Both creates folders with all upper_case name
        WIN/98 WIN/ME WIN/NT WIN2000
        Code:
        #Include "Win32api.inc"
        Function PbMain()As Long
          D$="C:\TESTING_UPPERCASE_DIRECTORY"
          CreateDirectory ByVal StrPtr(D$),ByVal %NULL
          MKDIR "C:\TESTING_ANOTHER_UPPERCASE"
        End Function
        ------------------
        Fred
        mailto:[email protected][email protected]</A>
        http://www.oxenby.se



        [This message has been edited by Fred Oxenby (edited August 21, 2001).]
        Fred
        mailto:[email protected][email protected]</A>
        http://www.oxenby.se

        Comment


        • #5
          Disregarding the actual mixed-case format the file name takes for a moment, is there a specific reason you need the names to be in a specific case format?

          That is, when querying the name with DIR$ or OPEN, etc, you can specify the name capitalized or lowercase or mixed and the file will be handled by Windows correctly.

          The only time you'll have any problems is if you are testing the filename without converting it to a specific case, ie:
          Code:
          IF DIR$("path\TheDataFile.dat") = "THEDATAFILE.DAT" THEN...
          ...may fail depending on the capitalization of the returned name, but if you convert the case, thus:
          Code:
          IF UCASE$(DIR$("path\TheDataFile.dat")) = "THEDATAFILE.DAT" THEN...
          ...then it will compare/match correctly since the case becomes irrelevent.


          ------------------
          Lance
          PowerBASIC Support
          mailto:[email protected][email protected]</A>
          Lance
          mailto:[email protected]

          Comment


          • #6
            In WIN/NT there are a setting (Properties Folder) "Allow all uppercase directory names"


            ------------------
            Fred
            mailto:[email protected][email protected]</A>
            http://www.oxenby.se

            Fred
            mailto:[email protected][email protected]</A>
            http://www.oxenby.se

            Comment


            • #7
              Right on, Fred. By default, Windows shows all-uppercase names as mixed case--
              one of those bad old historical quirks dating from Windows 95. Many versions
              of Windows have a setting in Folder Options / View that allows you to turn
              off this case mangling.


              ------------------
              Tom Hanlin
              PowerBASIC Staff

              Comment


              • #8
                Lance,
                I know what you are saying.
                The reason I need it all uppercase is cos im trying to match
                the output of an old DrOS program. It manages to create all
                uppercase FOLDER names. I dont want to get questions from my users
                "why are your folder Names different?"

                Edwin. I use Win98SE. When I finally pluck up the courage to spend
                a week buying new cards and installing drivers by hand I will switch
                to the promising win2k.

                ------------------
                Kind Regards
                Mike

                Comment


                • #9
                  Hi,

                  As Fred and Tom pointed out, there's a setting controling this behaviour.
                  This link describes the details.... http://www.winguides.com/registry/display.php/768/

                  -p


                  ------------------

                  Comment


                  • #10
                    Yeah I foubd it thx Fred and Tom

                    Is there a way to set that from my app?

                    per,
                    The page cannot be displayed


                    [This message has been edited by Mike Trader (edited August 21, 2001).]

                    Comment


                    • #11
                      [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced]
                      Value Name: "DontPrettyPath"
                      Value Data: (0 = adjust caps, 1 = show caps {don't adjust the capitalization}))

                      This is a "global" setting for the PC, so adjusting this may cause other side-effects, such as upset Windows users whose other filenames are now appearing differently!

                      If I were you, I'd make the use of this purely optional...

                      ------------------
                      Lance
                      PowerBASIC Support
                      mailto:[email protected][email protected]</A>
                      Lance
                      mailto:[email protected]

                      Comment


                      • #12
                        Mike,

                        doesn't show ? works fine from here, try : http://www.winguides.com/registry/
                        Then select the "Tips and Tricks" Category,
                        Then about mid-page, there's a link to : "Show File and Folder Names Using the Correct Case"

                        summary :
                        Key: [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced]
                        Value Name: DontPrettyPath
                        Data Type: REG_DWORD (DWORD Value)
                        Value Data: (0 = adjust caps, 1 = show caps)

                        To do it from Your app You need to use some registry API's, do a search here...

                        -p


                        ------------------

                        Comment


                        • #13
                          Please note that Windows is not changing the actual case of the directory.
                          It's only changing how the directory is displayed by, say, Windows Explorer.
                          Your own app remains free to display filespecs in any way it likes. Since
                          filespecs are (usually) not case-sensitive in Windows, of course, any
                          filespecs passed to your program may not be the "real" case: if you need to
                          retrieve the exact case as stored on disk, you'll need to use FindFirstFile
                          or some similar method.


                          ------------------
                          Tom Hanlin
                          PowerBASIC Staff

                          Comment

                          Working...
                          X