Skip to content

Commit 6578a2d

Browse files
committed
Update stdShell.cls
1 parent e4eaec2 commit 6578a2d

1 file changed

Lines changed: 11 additions & 8 deletions

File tree

src/WIP/stdShell.cls

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ End Property
261261
'@example ```vb
262262
'stdShell.Create("C:\my\files\song.mp3").Name
263263
'```
264-
Public Property Get Name(Obtional ByVal includingExtension as boolean = false) as string
264+
Public Property Get Name(Optional ByVal includingExtension as boolean = false) as string
265265
If This.kind = EShellFileTypeRoot Then Exit Property
266266
Name = Mid(This.path, InStrRev(This.path, "\") + 1)
267267
if not includingExtension then Name = Left(Name, InStrRev(Name, ".") - 1)
@@ -796,14 +796,15 @@ Public Function Delete() As Boolean
796796
On Error GoTo EH
797797
If Exists Then
798798
select case This.kind
799-
case EShellFileTypeRoot Then Exit Function
800-
case EShellFileTypeFolder Then
799+
case EShellFileTypeRoot
800+
Exit Function
801+
case EShellFileTypeFolder
801802
Dim child as stdShell
802803
For each child in Children
803804
child.Delete
804805
next
805806
RmDir This.path
806-
case EShellFileTypeFile Then
807+
case EShellFileTypeFile
807808
Kill This.path
808809
case else
809810
Err.Raise 1, "", "Cannot delete this item as it is not a file"
@@ -827,9 +828,11 @@ Public Function CopyTo(ByVal path As String) As Boolean
827828
If Exists Then
828829
select case This.kind
829830
case EShellFileTypeFile
830-
Call CopyFile(This.path, path)
831+
Call FileCopy(This.path, path)
831832
case EShellFileTypeFolder
832-
Call CopyFolder(This.path, path)
833+
With CreateObject("Scripting.FileSystemObject")
834+
Call .CopyFolder(This.path, path)
835+
End With
833836
case else
834837
Err.Raise 1, "", "Cannot copy this item as it is not a file or folder"
835838
end select
@@ -892,7 +895,7 @@ End Function
892895
Public Function Rename(ByVal newName As String) As Boolean
893896
On Error GoTo EH
894897
If Exists Then
895-
Call MoveTo(Parent.Path & "\" & newName & Extension)
898+
Call MoveTo(Parent.FullPath & "\" & newName & Extension)
896899
Rename = True
897900
End If
898901
Exit Function
@@ -983,7 +986,7 @@ End Function
983986

984987
'Indicates whether the item has the read-only attribute
985988
'@returns - True if read-only, False otherwise
986-
Private Property Get GenericAttribute(Byval iAttr as vbFileiAbute) as boolean
989+
Private Property Get GenericAttribute(Byval iAttr as vbFileAttribute) as boolean
987990
If This.kind = EShellFileTypeRoot Then Exit Property
988991
On Error GoTo EH
989992
If Exists Then

0 commit comments

Comments
 (0)