Results 1 to 7 of 7

Thread: Pre-Build needs no spaces!

  1. #1
    Wayetender is offline Registered User
    Join Date
    Aug 2004
    Posts
    28

    Pre-Build needs no spaces!

    I noticed that if i did a prebuild in a directory like C:\Documents and Settings it would fail because it thaught you were doing another argument.. a possible way to fix this would be like:
    Code:
    generate.exe --solutionDir=C:\Documents and settings--ProjectDir=C:\Documents and Settings\project--ProjectName=project

  2. #2
    michi's Avatar
    michi is offline Registered User
    Name: Michi Henning
    Organization: Triodia Technologies
    Project: I have a passing interest in Ice :-)
    Join Date
    Feb 2003
    Location
    Brisbane, Australia
    Posts
    1,055
    Ah, thanks for the bug report. Most likely, the solution is to put double quotes around the arguments used in the pre-build step in each project. (Your suggestion won't work because, by the time the arguments are passed to generate.cs, they are broken into separate tokens where the spaces are already.) I'll try this on Monday morning when I get to the office.

    Bloody spaces in file names -- they've never been a good idea and confuse all sorts of tools...

    Cheers,

    Michi.

  3. #3
    Wayetender is offline Registered User
    Join Date
    Aug 2004
    Posts
    28
    Originally posted by michi

    Bloody spaces in file names -- they've never been a good idea and confuse all sorts of tools...
    Yeah, I totally agree with you. I'll try the spaces and see what happens.

  4. #4
    michi's Avatar
    michi is offline Registered User
    Name: Michi Henning
    Organization: Triodia Technologies
    Project: I have a passing interest in Ice :-)
    Join Date
    Feb 2003
    Location
    Brisbane, Australia
    Posts
    1,055
    I tried various quoting tricks to allow the code to be built if the source tree is installed somewhere where a directory name contains a space, but to no avail. The problem isn't with generate.cs, but with the way Visual C# parses command-line arguments for the pre-build step. While it correctly invokes the generate.exe program if I put double quotes around the executable path in the pre-build step, it incorrectly breaks the executable name into to separate arguments where the space is, so generate.exe (correctly) concludes that it has been given invalid arguments.

    For example, if you rename the root directory (icecs) to (ice cs) and try to build, you get a pre-build failure because generate.exe is not found. If you then put double quotes around the command in the pre-build step, generate.exe is executed, but the command-line argument then are:

    [0] @"C:\cygwin\home\michi\src\ice"
    [1] @"cs\"
    [2] @"C:\cygwin\home\michi\src\ice"
    [3] @"cs\src\Ice\"
    [4] "Ice"

    Note that Visual C# splits the first argument into two arguments, which is simply wrong.

    This is a bug in Visual C#, and I don't believe there is a fix. My only suggestion is not to build in a directory hierarchy where a directory name contains a space.

    Cheers,

    Michi.

  5. #5
    Wayetender is offline Registered User
    Join Date
    Aug 2004
    Posts
    28
    I have an idea, this is what i did with a similar "echo" command for one of my control panels. I would rebuild the string array. Like so.. (assume args is the argument array)
    Code:
    string text = "";
    foreach(string arg in args)
    {
    	if(text == "")
    	{
    		text += arg;
    	}
    	else
    	{
    		text += " " + arg;
    	}
    }
    Sort of a hack job but it did the trick for me.

    **edit again**

    I'll add the processing code too. Then assume that each argument would be prepended with a ":" (not allowed in folder names).
    Code:
    string[] arguments = text.Split(char.Parse(":"));
    solution_dir = arguments[0];
    project_dir = arguments[1];
    project_name = arguments[2];
    arguments = arguments[3];
    **end of edit**
    Last edited by Wayetender; 08-16-2004 at 08:38 PM.

  6. #6
    michi's Avatar
    michi is offline Registered User
    Name: Michi Henning
    Organization: Triodia Technologies
    Project: I have a passing interest in Ice :-)
    Join Date
    Feb 2003
    Location
    Brisbane, Australia
    Posts
    1,055
    Well, maybe some sort of hack along those lines would work. But, to be honest, I'd rather just say "don't build Ice in a directory that has a space in its name". That's a lot easier and doesn't require writing any code

    Cheers,

    Michi.

  7. #7
    Wayetender is offline Registered User
    Join Date
    Aug 2004
    Posts
    28
    Alright, I was just letting you know.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Can a client pre-configure servers
    By KeithP in forum Help Center
    Replies: 2
    Last Post: 11-23-2009, 06:56 AM
  2. Installing ICE on path with spaces
    By kwaclaw in forum Bug Reports
    Replies: 1
    Last Post: 09-04-2007, 12:43 AM
  3. Use spaces instead of tabs
    By Edward Bishop in forum Comments
    Replies: 5
    Last Post: 01-24-2007, 05:42 PM
  4. Pre-Compiled Headers
    By mario in forum Help Center
    Replies: 9
    Last Post: 11-10-2005, 03:22 AM
  5. Pre-Build Failure
    By Wayetender in forum Help Center
    Replies: 8
    Last Post: 08-07-2004, 07:06 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
  •