Author Topic: Long-Path Library  (Read 9040 times)

0 Members and 1 Guest are viewing this topic.

Offline Theo Gottwald

  • Administrator
  • Hero Member
  • *****
  • Posts: 1110
  • Gender: Male
    • it-berater
Long-Path Library
« on: March 09, 2012, 07:30:36 AM »
NTFS supports pathes up to 32767 unicode characters.

Quote
Microsoft Windows uses the following types of paths:
local file system (LFS), such as C:\File,
uniform naming convention (UNC), such as \\Server\Volume\File,
Long UNC or UNCW, such as \\?\C:\File or \\?\UNC\Server\Volume\File.

I have to say that the windows standard tools like the explorer do not work with such long pathes.
And most programs do not (yet) support these also. Therefore this is a special issue.

Peter has provided a first implementation of a Large-Path Library. It substitutes the PB-commands with Commands that will enable you to utilize that large pathes.

[Theo: Attachement changed to newer version, 26.12.2014]
Download Wide-Path Library
« Last Edit: March 26, 2015, 08:29:02 AM by Theo Gottwald »

Offline Peter Weis

  • Sr. Member
  • ****
  • Posts: 350
  • Gender: Male
Re: Long-Path Library
« Reply #1 on: February 18, 2015, 10:11:05 AM »
 ;) Theo ich muss dir widersprechen. Das Ding ist absolut kugelsicher. Hatte keinen einzigen Ausfall die letzten beiden Jahre! hat alles kopiert und gelöscht ordnungsgemäß ohne Fehler!

Theo, I have to disagree with you. This thing is absolutely bulletproof. Had not a single failure, the last two years! has copied everything and deleted correctly without any errors!


Grüße Peter ;D
 
« Last Edit: February 18, 2015, 10:51:10 AM by Peter Weis »

Offline Theo Gottwald

  • Administrator
  • Hero Member
  • *****
  • Posts: 1110
  • Gender: Male
    • it-berater
Re: Long-Path Library
« Reply #2 on: March 25, 2015, 07:38:39 AM »
I have now checked Peters Code and it has shown up that there were no bugs in the whole library.
Peters code is remarkable bug free. I have also corrected the Link and reduced the filesize to ~14 MB.
I have removed some obsolete posts so we can concentrate on further issues.
« Last Edit: March 26, 2015, 08:55:37 AM by Theo Gottwald »

Offline Peter Weis

  • Sr. Member
  • ****
  • Posts: 350
  • Gender: Male
Re: Long-Path Library
« Reply #3 on: April 11, 2015, 05:29:37 PM »
Habe die Function WideCopyDir verändert. So das eine Datei die schon existiert und Readonly ist auch überschrieben wird, und nicht abgebrochen wird :)

Have changed the Function WideCopydir. So that the file already exists and is read-only will be overwritten, and will not be canceled

Code: [Select]
FUNCTION WideCopyDir ALIAS "WideCopyDir"(BYVAL pSource AS WSTRING, BYVAL Pdest AS WSTRING, BYVAL bFailIfExists AS LONG, OPT BYREF recusive AS LONG) EXPORT AS LONG

    LOCAL fcount AS LONG
    LOCAL i AS LONG
    LOCAL f AS WSTRING
    LOCAL d1 AS WSTRING
    LOCAL p1 AS WSTRING
    LOCAL f1 AS WSTRING
    LOCAL l AS LONG

    LOCAL lstring AS ASCIZ * 32000



    wsplitf psource, d1, p1, f1
    Psource = RTRIM$(psource, "\")

    l = LEN(d1) + LEN(p1) + 1

    pdest = TRIM$(pdest)
    IF RIGHT$(pdest, 1) <> "\" THEN
        pdest = pdest + "\"
    END IF


    IF WideIsFolder(psource) THEN
        WideMkdir(pdest + f1)

        LOCAL dirclass AS WidedirRead
        LET dirclass = CLASS "WideDirReadCom"
        IF ISOBJECT(dirclass) THEN
            IF NOT ISMISSING(recusive) THEN
                fcount = dirclass.WideDirReadX(pSource + "\*", %F_NOT_PREV_DIR OR %F_NOT_THIS_DIR, recusive)
            ELSE
                fcount = dirclass.WideDirReadX(pSource + "\*", %F_NOT_PREV_DIR OR %F_NOT_THIS_DIR)
            END IF

            IF WideisFolder(pdest + LTRIM$(f1, "\")) THEN


                FOR i = 1 TO dirclass.dircount()
                    f = Pdest + LTRIM$(MID$(dirclass.FName(i), l), "\")

                    IF (dirclass.FGetattr(i) AND %FILE_ATTRIBUTE_DIRECTORY) THEN
                        WideMkdir f

                    ELSE
                        IF WideCopyFile (dirclass.FName(i), f, bFailIfExists) = 0 THEN
                            IF bFailIfExists = 0 THEN
                                WideSetAttr(f, widegetattr(f) AND &HFFFFFFFC)
                                IF WideCopyFile (dirclass.FName(i), f, bFailIfExists) <> 0 THEN
                                    ITERATE FOR
                                END IF
                                dirclass = NOTHING
                                EXIT FUNCTION
                            END IF
                        END IF
                    END IF
                NEXT i
                FUNCTION = %true
            END IF
        END IF
        dirclass = NOTHING

    END IF

END FUNCTION         
« Last Edit: April 11, 2015, 05:44:18 PM by Peter Weis »