Changes between Initial Version and Version 1 of Ticket #2909, comment 8


Ignore:
Timestamp:
09/27/14 22:17:02 (10 years ago)
Author:
guinness
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #2909, comment 8

    initial v1  
    11Since the first line is a bug, I am reverting back to a bug and fixing with this code. As for your feature request, it's outside the scope of the function and thus I am rejecting it. As this is something you can implement yourself I see no reason to add a script breaking change.
     2
     3
     4{{{
     5Func _PathMake($sDrive, $sDir, $sFileName, $sExtension)
     6        ; Format $sDrive, if it's not a UNC server name, then just get the drive letter and add a colon
     7        If StringLen($sDrive) Then
     8                If Not (StringLeft($sDrive, 2) = "\\") Then $sDrive = StringLeft($sDrive, 1) & ":"
     9        EndIf
     10
     11        ; Format the directory by adding any necessary slashes
     12        If StringLen($sDir) Then
     13                If Not (StringRight($sDir, 1) = "\") And Not (StringRight($sDir, 1) = "/") Then $sDir = $sDir & "\"
     14        Else
     15                $sDir = "\"
     16        EndIf
     17
     18        If StringLen($sDir) Then
     19                ; Append a backslash to the start of the directory if required
     20                If Not (StringLeft($sDir, 1) = "\") And Not (StringLeft($sDir, 1) = "/") Then $sDir = "\" & $sDir
     21        EndIf
     22
     23        ; Nothing to be done for the filename
     24
     25        ; Add the period to the extension if necessary
     26        If StringLen($sExtension) Then
     27                If Not (StringLeft($sExtension, 1) = ".") Then $sExtension = "." & $sExtension
     28        EndIf
     29
     30        Return $sDrive & $sDir & $sFileName & $sExtension
     31EndFunc   ;==>_PathMake
     32}}}