Results 1 to 6 of 6

Thread: [2005] Converting Directory string to a cygwin compatible format

Threaded View

  1. #1

    Thread Starter
    Member
    Join Date
    Jul 2007
    Location
    Silly Clone Valley CA
    Posts
    47

    [2005] Converting Directory string to a cygwin compatible format

    cygwin is a program that allows you to use the unix bash shell on your xp machine. I need my vb program to send it some commands (rsync rsh files to and from a device connected by usb and detected as a network server) , but since it doesn't understand Windows directory syntax it doesn't work. So here is what I do to get around it:

    Code:
           
            Dim OutDirectory As String = My.Settings.LogOutDirectory
            Dim CygWinDirectory As String
            CygWinDirectory = OutDirectory.Replace("\", "/")
            OutDirectory = CygWinDirectory.Replace(" ", "\ ")
            CygWinDirectory = OutDirectory.Replace(":", "")
            OutDirectory = CygWinDirectory.Insert(0, "/")
            CygWinDirectory = OutDirectory.Replace("(", "\(")
            OutDirectory = CygWinDirectory.Replace(")", "\)")
            CygWinDirectory = OutDirectory.Replace("!", "\!")
    Anyone have any suggestions on a better way to do this string manipulation?

    Basically, Unix doesn't understand spaces, characters like "(,!,$,^,)", and usualy starts the line with "/c/" as in "/c/Programs\ and\ settings/".

    In the code above the variable Fliping from one to another looks kinda janky, but it does work, so if you need to send directories to your unix this will do it, but I'm sure there is a better way.
    Last edited by SlumberMachine; Jul 13th, 2007 at 09:27 PM.

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