View source code
Display the source code in dmd/utils.d from which this
page was generated on github.
Report a bug
If you spot a problem with this page, click here to create a
Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page.
Requires a signed-in GitHub account. This works well for small changes.
If you'd like to make larger changes you may want to consider using
local clone.
Function dmd.utils.writeEscapedMakePath
Takes a path, and make it compatible with GNU Makefile format.
GNU make uses a weird quoting scheme for white space. A space or tab preceded by 2N+1 backslashes represents N backslashes followed by space; a space or tab preceded by 2N backslashes represents N backslashes at the end of a file name; and backslashes in other contexts should not be doubled.
Parameters
Name | Description |
---|---|
buf | Buffer to write the escaped path to |
fname | Path to escape |
Example
version (Windows)
{
enum input = `C:\My Project\file#4$.ext`;
enum expected = `C:\My\ Project\file\#4$$.ext`;
}
else
{
enum input = `/foo\bar/weird$.:name#\ with spaces.ext`;
enum expected = `/foo\bar/weird$$.\:name\#\\\ with\ spaces.ext`;
}
OutBuffer buf;
buf .writeEscapedMakePath(input);
writeln(buf[]); // expected
Authors
License
Copyright © 1999-2024 by the D Language Foundation | Page generated by ddox.