English 中文(简体)
我如何确保在OMake引用名录?
原标题:How do I make sure that a directory name is quoted in OMake?

我有一套比较复杂的OMake文档,用于在一个具体平台上进行交叉编造。 我的资料来源是C++。

来自Windows的Im楼和我需要通过编辑部,其中包括其名称有空间的名录。 为汇编档案而在指挥线上插入的插图方式按行:

public.PREFIXED_INCLUDES = $`(addprefix $(INCLUDES_OPT), $(set $(absname $(INCLUDES))))

在OMake案档案的另一些时候,我有这样的一线:

INCLUDES += $(dir "$(LIBRARY_LOCATION)/Path with spaces/include")

在指挥线的中段,这扩大到:

-IC:Library location with spacesPath with spacesinclude

我想将其扩大到:

-I"C:Library location with spacesPath with spacesinclude"

我不想作任何改动,但“INCLUDES +=......”线可能的话,尽管对该档案中其他内容的修改也是罚款。 我不想做像改变“PREFIXED”的定义一样的事情。 INCLUDES,作为OMake案卷的一部分,这些档案可能改在我后面。 这是可能的吗? 如果是的话,我如何能够这样做? 如果不是的话,那么,我能以什么方式确保,包括其中的空间,通过修改很少的纸面代码(全线一行)来加以引用?

问题回答

标准图书馆功能<代码> 此外,还引述了它的论点,因此它应当做以下工作:

INCLUDES += $(quote $(dir "$(LIBRARY_LOCATION)/Path with spaces/include"))

如有必要,见quote ,载于Omake Manual

如果其他人面临同样的问题,我就认为我赞成我最终提出的解决办法,从来就没有说明如何处理引述。 我不是在名称上用空话,而是把路向短(8.3)。 我通过一份简明的“J”文本,称为“缩短......js”和一个线“OMake”功能。

文字:

// Get Access to the file system.
var FileSystemObject = WScript.CreateObject("Scripting.FileSystemObject");

// Get the short path.
var shortPath = FileSystemObject.GetFolder(WScript.Arguments(0)).ShortPath;

// Output short path.
WScript.StdOut.Write(shortPath);

该职能:

ShortDirectoryPath(longPath) =
    return $(dir $(shell cscript /Nologo $(dir ./tools/shorten.js) "$(absname $(longPath))"))

因此,我现在只使用一条像以下的线:

INCLUDES += $(ShortDirectoryPath $(dir "$(LIBRARY_LOCATION)/Path with spaces/include"))




相关问题
Code snippet paths in GCC

Background: Keil C51 on a PC, currently moving to GCC (CrossPack-AVR) on an iMac. Since I write firmware for micro s I have a lot of driver source files etc. that I need to include with my programs,...

C#/.NET app doesn t recognize Environment Var Change (PATH)

In my C# app, I am programmatically installing an Oracle client if one is not present, which requires adding a dir to the PATH system environment variable. This all works fine, but it doesn t take ...

PHP absolute path to file URI

In order to refer to a local DTD when using PHP SimpleXML, I need to convert the absolute path into a file type URI. For example, convert /home/sitename/www/xml/example.dtd to file:///home/sitename/...

Check if files with absolute and relative path exists

Is there a way to check whether files (with either an absolute or relative path) exists? Im using PHP. I found a couple of method but either they only accept absolute or relative but not both. Thanks.

How to get file path of the file with the running-vba code

I want to get the folder path from the file who is running the vba-code. For example: the vba-code is in the file C:myfolderfile.accdb and I want the vba-code to return C:myfolder Is that ...

热门标签