Link to home
Start Free TrialLog in
Avatar of ice_nin
ice_nin

asked on

C# main and Spacey paths - Kindo of an silly one!

I have an application that will take 2 parameters both of them paths. i came across a bug in my code that im not sure how to fix

From the title you can guess that its something to do with spacey paths.

Is there anyway (without having to put quotes around the path) of getting the whole path and not just a partial path if it contains spaces.
ASKER CERTIFIED SOLUTION
Avatar of TheAvenger
TheAvenger
Flag of Switzerland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Octabun
Octabun

However, if you know what the paths are to be like, you can combine 3 or more parameters you get into 2 paths. For example, if you know that you are getting 2 paths none of which has more then 1 consequtive space, and you have received 5 parameters, then you can get only 4 different sets of possible values.

You may create a function that assignes some score to each variant and select the one with the top score, or you may test if a path exists if it should, and so on....

If paths should exist, you can try to append parameters one by one: get the list of entries in the current directory and see if you can create a valid entry adding the next parameter separated by arbitrary number of spaces.

So, if there is no additional data on the paths, then the answer is NO. If there is such data, the answer is MAYBE YES.