|
-
Jun 27th, 2004, 11:00 AM
#1
Thread Starter
Member
Bug in code. Help?
Theres a bug in my code for recieving remote directory list.. For some reason it seems to put an "F" at the end of the file name and I also can't access this file. I hope someone can help cause I've been banging my head over this... You can see screenshots and download the project here:http://www.shepstype-r.com/rfm_error/index.php
I think this is where it is...
VB Code:
Public Sub ChangeDirectory(ByVal NewDirectory As String)
' "CHG"/Directory
If Not bCon Then Exit Sub
If Len(NewDirectory) = 0 Then Exit Sub
Dim sPacket As String
sPacket = "CHG" & DELIM & NewDirectory
frmMain.sckMain.SendData sPacket & EOP
End Sub
Public Sub ParseChangeDirectory(ByVal Data As String)
On Error Resume Next
' Successfull: "CHG"/"Directory"/D:Folder1|F:File1*123|F:File2*123
' Folder doesn't exist: "CHG"/"Directory"/"NonExist"
Dim sBuff() As String: sBuff() = Split(Data, DELIM)
If sBuff(2) = "NonExist" Then
frmMain.StatusBar.SimpleText = "Status: Error changing directory; directory does not exist."
Exit Sub
Else
sCurDir = sBuff(1)
frmMain.txtCurDir.Text = sCurDir
Dim sDir() As String, sType() As String, lLoop As Long, sTmpDir As String, sSize() As String
sDir() = Split(sBuff(2), "|")
With frmMain
.TVDir.Nodes.Clear
.LVFile.ListItems.Clear
For lLoop = 0 To UBound(sDir)
sTmpDir = sDir(lLoop)
If Len(sTmpDir) > 0 Then
sType() = Split(sTmpDir, "*?*")
If sType(0) = "D" Then
.TVDir.Nodes.Add , , sType(1), sType(1), "Dir"
ElseIf sType(0) = "F" Then
sSize() = Split(sType(1), "*")
.LVFile.ListItems.Add , , sSize(0), , "FN"
.LVFile.ListItems(.LVFile.ListItems.Count).ListSubItems.Add , , BytesToKB(CDbl(sSize(1)))
.LVFile.ListItems(.LVFile.ListItems.Count).ListSubItems(1).Bold = True
End If
End If
Next lLoop
.LVFile.Refresh
End With
End If
End Sub
Thanks for any help or comments/suggestions!!!!!
$hep
Last edited by $hep; Jun 27th, 2004 at 03:11 PM.
-
Jun 29th, 2004, 02:44 PM
#2
Its not a bug. That File Manager is from PSC i remember looking at this a few months back. The "F" is a delmiter to recgonise where the last folder is. Its so you can distinguish the difference between files and folders. Its just bad coding. If you want to change it you'll need to redo the whole enumerating the files and folders part.
-
Jun 29th, 2004, 11:01 PM
#3
chnage the F to a space and do the same on the server side, though this may cause other problems.
-
Jun 30th, 2004, 09:09 AM
#4
Thread Starter
Member
Your right..Its from PSC..I downloaded it cause I could use it. And I wanted to play with it. It seemed like good code..Compared to some others.
It seems to only add the "F" to folders with a large amount folders inside. Then it won't let you inside that folder. I'll try changing the "F" to " " on both server/client...Is this what you mean?
Thanks for your help..!
$hep
-
Jun 30th, 2004, 09:46 PM
#5
Thread Starter
Member
It works!
Thanks for the hint Jmacp!!!!
$hep
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|