Results 1 to 4 of 4

Thread: Path.Combine... aint working right

  1. #1

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428

    Path.Combine... aint working right

    I want to combine "C:\windows\" with "..\System" and get "C:\windows\system"

    I'm using Path.Combine() and it just returns "C:\windows\..\system" which is wrong. I thought there is a way to combine these kind of paths.

    am I doing anything wrong? or is it just the way it is?
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  2. #2
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    That's how I did it and worked . Do you have any white space before string paths ?
    VB Code:
    1. Dim path1 As String = "c:\windows\"
    2.         Dim path2 As String = "system32\"
    3.  
    4.         Dim tmp As String = IO.Path.Combine(path1, path2)
    5.         MessageBox.Show(tmp)

  3. #3

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    well I'm combining it with "..\system32" not with "system32"

    windows should be still able to access the path anyways, but I was wondering if I was doing it wonrg I guess it's the way it is, bleh
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  4. #4
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    It sounds you're trying to go difficult . How about now with Join function !
    VB Code:
    1. Dim path1 As String = "c:\windows"
    2.         Dim path2 As String = "system32"
    3.  
    4.         Dim tmp As String = String.Join("\", New String() {path1, path2})
    5.  
    6.         MessageBox.Show(tmp)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width