Menu

Need to modify path funcs in "utils.pas" file

2004-11-24
2012-09-26
  • Alex Yoon Jong Joh

    I posted one message called "Bug 1068471 : Filename handling" and maybe someone thought that it is bug reporting.

    However, it's not related to Dev-C++ or user programming.

    On the bug 1068471, someone complained about "&" keyword and, unfortunately, windows file system accept this symbol for the filename.

    The filenames contained "&" char in their filename must have quotation mark before and after filename.

    I guess the function, GetMakePath, should change like this

    In the 743 in utils.pas file
    { GenMakePath: convert a filename to a format that can be
    used by make }
    function GenMakePath(FileName: String): String;
    begin
    Result:=StringReplace(Filename, '\', '/', [rfReplaceAll]);
    if (Pos(' ', Filename)>0) or (Pos('&', Filename)>0) then
    Result := '"'+Result+'"';
    end;

    To keep the consistency between GetMakePath and GetMakePath2, why don't you change GetMakePath2 to like this :

    function GenMakePath2(FileName: String): String;
    var
    S: String;
    begin
    Result := '';

    { Convert backslashes to slashes }
    S:=StringReplace(Filename, '\', '/', [rfReplaceAll]);

    Result := StringReplace(S, ' ', '/ ', [rfReplaceAll]);

    end;

    or

    function GenMakePath2(FileName: String): String;
    begin
    Result := '';

    { Convert backslashes to slashes }
    Filename:=StringReplace(Filename, '\', '/', [rfReplaceAll]);

    Result := StringReplace(Filename, ' ', '/ ', [rfReplaceAll]);

    end;

    If this is not right post on this forum, please leave a comment on this post.

    Sorry if this message bothers you guys

     
    • Alex Yoon Jong Joh

      Sorry. I wrote wrong replace code for ESCAPE SPACE.

      function GenMakePath2(FileName: String): String;
      begin
      Result := '';

      { Convert backslashes to slashes }
      Filename:=StringReplace(Filename, '\', '/', [rfReplaceAll]);

      Result := StringReplace(Filename, ' ', '/ ', [rfReplaceAll]);

      end;

      To

      function GenMakePath2(FileName: String): String;
      begin
      { Convert backslashes to slashes }
      Filename:=StringReplace(Filename, '\', '/', [rfReplaceAll]);

      Result := StringReplace(Filename, ' ', '\ ', [rfReplaceAll]);

      end;

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.