diff options
| author | ruki <waruqi@gmail.com> | 2019-06-23 22:48:51 +0800 |
|---|---|---|
| committer | ruki <waruqi@gmail.com> | 2019-06-23 22:48:51 +0800 |
| commit | 49a742c10a9591a160f50851ebf225f2469c4c45 (patch) | |
| tree | f3dc387ff682d8f6ced49bec72fbe7b1892e1c1e | |
| parent | 325a6a14da0330cfe1059428edf212b1cfa6716e (diff) | |
| download | xmake-docs-49a742c10a9591a160f50851ebf225f2469c4c45.tar.gz xmake-docs-49a742c10a9591a160f50851ebf225f2469c4c45.zip | |
fix links for builtin modules
| -rw-r--r-- | manual/builtin_modules.md | 172 | ||||
| -rw-r--r-- | zh-cn/manual/builtin_modules.md | 172 |
2 files changed, 172 insertions, 172 deletions
diff --git a/manual/builtin_modules.md b/manual/builtin_modules.md index ae09cb39..7045cee5 100644 --- a/manual/builtin_modules.md +++ b/manual/builtin_modules.md @@ -69,7 +69,7 @@ target("test") #### Get the value of the built-in variable -[Built-in variables](#built-in variables) can be obtained directly through this interface, without the need to add a `$()` package, which is much simpler to use, for example: +[Built-in variables](/manual/builtin_variables) can be obtained directly through this interface, without the need to add a `$()` package, which is much simpler to use, for example: ```lua print(val("host")) @@ -91,7 +91,7 @@ However, `vformat` supports string parameter formatting, which is more powerful, Import is mainly used to import xmake's extension class library and some custom class library modules, generally used to: -* Custom script ([on_build](#targeton_build), [on_run](#targeton_run) ..) +* Custom script ([on_build](/manual/project_target?id=targeton_build), [on_run](/manual/project_target?id=targeton_run) ..) * Plugin development * Template development * Platform extension @@ -585,7 +585,7 @@ This interface is similar to [cprint](#cprint), the difference is that it does n #### Formatting a string -If you just want to format the string and don't output it, you can use this interface. This interface is equivalent to the [string.format](#string-format) interface, just a simplified version of the interface name. +If you just want to format the string and don't output it, you can use this interface. This interface is equivalent to the [string.format](#stringformat) interface, just a simplified version of the interface name. ```lua local s = format("hello %s", xmake) @@ -617,7 +617,7 @@ If an exception is thrown in the try block, the error information is captured in #### Finding dependencies -This interface is a wrapper around the [lib.detect.find_package](#detect-find_package) interface and provides lookup support for multiple dependencies, for example: +This interface is a wrapper around the [lib.detect.find_package](/manual/extension_modules?id=detectfind_package) interface and provides lookup support for multiple dependencies, for example: ```lua target("test") @@ -640,38 +640,38 @@ Only some readonly interfaces (for example: `os.getenv`, `os.arch`) in the os mo | Interface | Description | Supported Versions | | ----------------------------------------------- | -------------------------------------------- | -------- | -| [os.cp](#os-cp) | Copy files or directories | >= 2.0.1 | -| [os.mv](#os-mv) | Move Renamed File or Directory | >= 2.0.1 | -| [os.rm](#os-rm) | Delete files or directory tree | >= 2.0.1 | -| [os.trycp](#os-trycp) | Try copying files or directories | >= 2.1.6 | -| [os.trymv](#os-trymv) | Try moving the renamed file or directory | >= 2.1.6 | -| [os.tryrm](#os-tryrm) | Try deleting a file or directory tree | >= 2.1.6 | -| [os.cd](#os-cd) | Go to the specified directory | >= 2.0.1 | -| [os.rmdir](#os-rmdir) | Delete Directory Tree | >= 2.0.1 | -| [os.mkdir](#os-mkdir) | Create the specified directory | >= 2.0.1 | -| [os.isdir](#os-isdir) | Determine if the directory exists | >= 2.0.1 | -| [os.isfile](#os-isfile) | Determine if the file exists | >= 2.0.1 | -| [os.exists](#os-exists) | Determine if a file or directory exists | >= 2.0.1 | -| [os.dirs](#os-dirs) | Traversing to get all directories under the specified directory | >= 2.0.1 | -| [os.files](#os-files) | Traversing to get all the files in the specified directory | >= 2.0.1 | -| [os.filedirs](#os-filedirs) | Traversing to get all files or directories under the specified directory | >= 2.0.1 | -| [os.run](#os-run) | Quiet running program | >= 2.0.1 | -| [os.runv](#os-runv) | Quiet running program with parameter list | >= 2.1.5 | -| [os.exec](#os-exec) | Evoke Run Program | >= 2.0.1 | -| [os.execv](#os-execv) | Echo running program with parameter list | >= 2.1.5 | -| [os.iorun](#os-iorun) | Run and get the program output | >= 2.0.1 | -| [os.iorunv](#os-iorunv) | Run and get the program output with parameter list | >= 2.1.5 | -| [os.getenv](#os-getenv) | Get Environment Variables | >= 2.0.1 | -| [os.setenv](#os-setenv) | Setting environment variables | >= 2.0.1 | -| [os.tmpdir](#os-tmpdir) | Get Temp directory path | >= 2.0.1 | -| [os.tmpfile](#os-tmpfile) | Get Temporary File Path | >= 2.0.1 | -| [os.curdir](#os-curdir) | Get current directory path | >= 2.0.1 | -| [os.filesize](#os-filesize) | Get File Size | >= 2.1.9 | -| [os.scriptdir](#os-scriptdir) | Get script directory path | >= 2.0.1 | -| [os.programdir](#os-programdir) | Get xmake install main program script directory | >= 2.1.5 | -| [os.projectdir](#os-projectdir) | Get Project Home | |= 2.1.5 | -| [os.arch](#os-arch) | Get Current System Architecture | >= 2.0.1 | -| [os.host](#os-host) | Get Current Host System | >= 2.0.1 | +| [os.cp](#oscp) | Copy files or directories | >= 2.0.1 | +| [os.mv](#osmv) | Move Renamed File or Directory | >= 2.0.1 | +| [os.rm](#osrm) | Delete files or directory tree | >= 2.0.1 | +| [os.trycp](#ostrycp) | Try copying files or directories | >= 2.1.6 | +| [os.trymv](#ostrymv) | Try moving the renamed file or directory | >= 2.1.6 | +| [os.tryrm](#ostryrm) | Try deleting a file or directory tree | >= 2.1.6 | +| [os.cd](#oscd) | Go to the specified directory | >= 2.0.1 | +| [os.rmdir](#osrmdir) | Delete Directory Tree | >= 2.0.1 | +| [os.mkdir](#osmkdir) | Create the specified directory | >= 2.0.1 | +| [os.isdir](#osisdir) | Determine if the directory exists | >= 2.0.1 | +| [os.isfile](#osisfile) | Determine if the file exists | >= 2.0.1 | +| [os.exists](#osexists) | Determine if a file or directory exists | >= 2.0.1 | +| [os.dirs](#osdirs) | Traversing to get all directories under the specified directory | >= 2.0.1 | +| [os.files](#osfiles) | Traversing to get all the files in the specified directory | >= 2.0.1 | +| [os.filedirs](#osfiledirs) | Traversing to get all files or directories under the specified directory | >= 2.0.1 | +| [os.run](#osrun) | Quiet running program | >= 2.0.1 | +| [os.runv](#osrunv) | Quiet running program with parameter list | >= 2.1.5 | +| [os.exec](#osexec) | Evoke Run Program | >= 2.0.1 | +| [os.execv](#osexecv) | Echo running program with parameter list | >= 2.1.5 | +| [os.iorun](#osiorun) | Run and get the program output | >= 2.0.1 | +| [os.iorunv](#osiorunv) | Run and get the program output with parameter list | >= 2.1.5 | +| [os.getenv](#osgetenv) | Get Environment Variables | >= 2.0.1 | +| [os.setenv](#ossetenv) | Setting environment variables | >= 2.0.1 | +| [os.tmpdir](#ostmpdir) | Get Temp directory path | >= 2.0.1 | +| [os.tmpfile](#ostmpfile) | Get Temporary File Path | >= 2.0.1 | +| [os.curdir](#oscurdir) | Get current directory path | >= 2.0.1 | +| [os.filesize](#osfilesize) | Get File Size | >= 2.1.9 | +| [os.scriptdir](#osscriptdir) | Get script directory path | >= 2.0.1 | +| [os.programdir](#osprogramdir) | Get xmake install main program script directory | >= 2.1.5 | +| [os.projectdir](#osprojectdir) | Get Project Home | |= 2.1.5 | +| [os.arch](#osarch) | Get Current System Architecture | >= 2.0.1 | +| [os.host](#oshost) | Get Current Host System | >= 2.0.1 | #### os.cp @@ -706,7 +706,7 @@ Try to use the `os.cp` interface instead of `os.run("cp ..")`, which will ensure - Move to rename a file or directory -Similar to the use of [os.cp](#os-cp), it also supports multi-file move operations and pattern matching, for example: +Similar to the use of [os.cp](#oscp), it also supports multi-file move operations and pattern matching, for example: ```lua -- Move multiple files to a temporary directory @@ -730,7 +730,7 @@ os.rm("$(buildir)/inc/**.h", "$(buildir)/lib/") - Try copying files or directories -Similar to [os.cp](#os-cp), the only difference is that this interface operation will not throw an exception interrupt xmake, but the return value indicates whether the execution is successful. +Similar to [os.cp](#oscp), the only difference is that this interface operation will not throw an exception interrupt xmake, but the return value indicates whether the execution is successful. ```lua if os.trycp("file", "dest/file") then @@ -741,7 +741,7 @@ end - Try moving a file or directory -Similar to [os.mv](#os-mv), the only difference is that this interface operation will not throw an exception interrupt xmake, but the return value indicates whether the execution is successful. +Similar to [os.mv](#osmv), the only difference is that this interface operation will not throw an exception interrupt xmake, but the return value indicates whether the execution is successful. ```lua if os.trymv("file", "dest/file") then @@ -752,7 +752,7 @@ end - Try deleting files or directories -Similar to [os.rm](#os-rm), the only difference is that this interface operation will not throw an exception interrupt xmake, but the return value indicates whether the execution is successful. +Similar to [os.rm](#osrm), the only difference is that this interface operation will not throw an exception interrupt xmake, but the return value indicates whether the execution is successful. ```lua if os.tryrm("file") then @@ -909,7 +909,7 @@ For more advanced process operations and control, see the [process](#process) mo - Quietly running native shell commands with parameter list -Similar to [os.run](#os-run), just the way to pass parameters is passed through the parameter list, not the string command, for example: +Similar to [os.run](#osrun), just the way to pass parameters is passed through the parameter list, not the string command, for example: ```lua os.runv("echo", {"hello", "xmake!"}) @@ -919,13 +919,13 @@ os.runv("echo", {"hello", "xmake!"}) - Echo running native shell commands -Similar to the [os.run](#os-run) interface, the only difference is that when this interface executes the shell program, it has the output output, which is used in general debugging. +Similar to the [os.run](#osrun) interface, the only difference is that when this interface executes the shell program, it has the output output, which is used in general debugging. #### os.execv - Echo running native shell commands with parameter list -Similar to [os.execv](#os-execv), just the way to pass parameters is passed through the parameter list, not the string command, for example: +Similar to [os.execv](#osexecv), just the way to pass parameters is passed through the parameter list, not the string command, for example: ```lua os.execv("echo", {"hello", "xmake!"}) @@ -935,7 +935,7 @@ os.execv("echo", {"hello", "xmake!"}) - Quietly running native shell commands and getting output -Similar to the [os.run](#os-run) interface, the only difference is that after executing the shell program, this interface will get the execution result of the shell program, which is equivalent to redirecting the output. +Similar to the [os.run](#osrun) interface, the only difference is that after executing the shell program, this interface will get the execution result of the shell program, which is equivalent to redirecting the output. You can get the contents of `stdout`, `stderr` at the same time, for example: @@ -947,7 +947,7 @@ local outdata, errdata = os.iorun("echo hello xmake!") - Run the native shell command quietly and get the output with a list of parameters -Similar to [os.iorunv](#os-iorunv), just the way to pass arguments is passed through the argument list, not the string command, for example: +Similar to [os.iorunv](#osiorunv), just the way to pass arguments is passed through the argument list, not the string command, for example: ```lua local result, errors = os.iorunv("echo", {"hello", "xmake!"}) @@ -997,7 +997,7 @@ Used to get a temporary file path, just a path, the file needs to be created by Consistent with the result of [$(curdir)](#var-curdir), it is just a direct return to return a variable that can be maintained with subsequent strings. -Usage reference: [os.tmpdir](#os-tmpdir). +Usage reference: [os.tmpdir](#ostmpdir). #### os.filesize @@ -1013,7 +1013,7 @@ print(os.filesize("/tmp/a")) Consistent with the result of [$(scriptdir)](#var-scriptdir), it is just a direct return to return a variable that can be maintained with subsequent strings. -Usage reference: [os.tmpdir](#os-tmpdir). +Usage reference: [os.tmpdir](#ostmpdir). #### os.programdir @@ -1045,16 +1045,16 @@ The io operation module extends lua's built-in io module to provide more easy-to | Interface | Description | Supported Versions | | ----------------------------------------------- | -------------------------------------------- | -------- | -| [io.open](#io-open) | Open file for reading and writing | >= 2.0.1 | -| [io.load](#io-load) | De-serialize all table contents from the specified path file | >= 2.0.1 | -| [io.save](#io-save) | Serialize all table contents to the specified path file | >= 2.0.1 | +| [io.open](#ioopen) | Open file for reading and writing | >= 2.0.1 | +| [io.load](#ioload) | De-serialize all table contents from the specified path file | >= 2.0.1 | +| [io.save](#iosave) | Serialize all table contents to the specified path file | >= 2.0.1 | | [io.readfile](#io.readfile) | Read everything from the specified path file | >= 2.1.3 | | [io.writefile](#io.writefile) | Write everything to the specified path file | >= 2.1.3 | -| [io.gsub](#io-gsub) | Full text replaces the contents of the specified path file | >= 2.0.1 | -| [io.tail](#io-tail) | Read and display the tail of the file | >= 2.0.1 | -| [io.cat](#io-cat) | Read and display all contents of a file | >= 2.0.1 | -| [io.print](#io-print) | Formatting output with a line feed to a file | >= 2.0.1 | -| [io.printf](#io-printf) | No line formatted output to file | >= 2.0.1 | +| [io.gsub](#iogsub) | Full text replaces the contents of the specified path file | >= 2.0.1 | +| [io.tail](#iotail) | Read and display the tail of the file | >= 2.0.1 | +| [io.cat](#iocat) | Read and display all contents of a file | >= 2.0.1 | +| [io.print](#ioprint) | Formatting output with a line feed to a file | >= 2.0.1 | +| [io.printf](#ioprintf) | No line formatted output to file | >= 2.0.1 | #### io.open @@ -1102,7 +1102,7 @@ end - Load all table contents from the specified path file deserialization -You can load serialized table contents from a file, generally used with [io.save](#io-save), for example: +You can load serialized table contents from a file, generally used with [io.save](#iosave), for example: ```lua -- Load the contents of the serialized file to the table @@ -1118,7 +1118,7 @@ end - Serialize all table contents to the specified path file -You can serialize the contents of the table to the specified file, generally used in conjunction with [io.load](#io-load), for example: +You can serialize the contents of the table to the specified file, generally used in conjunction with [io.load](#ioload), for example: ```lua io.save("xxx.txt", {a = "a", b = "b", c = "c"}) @@ -1158,7 +1158,7 @@ io.writefile("xxx.txt", "all data") - Full text replaces the contents of the specified path file -Similar to the [string.gsub](#string-gsub) interface, the full-text pattern matches the replacement content, but here is the direct operation file, for example: +Similar to the [string.gsub](#stringgsub) interface, the full-text pattern matches the replacement content, but here is the direct operation file, for example: ```lua -- Remove all whitespace characters from the file @@ -1212,16 +1212,16 @@ The path operation module implements cross-platform path operations, which is a | Interface | Description | Supported Versions | | ----------------------------------------------- | -------------------------------------------- | -------- | -| [path.join](#path-join) | Stitching Path | >= 2.0.1 | -| [path.translate](#path-translate) | Convert path to the path style of the current platform | >= 2.0.1 | -| [path.basename](#path-basename) | Get the file name with no suffix at the end | >= 2.0.1 | -| [path.filename](#path-filename) | Get the file name with the last suffix of the path | >= 2.0.1 | -| [path.extension](#path-extension) | Get the suffix of the path | >= 2.0.1 | -| [path.directory](#path-directory) | Get the last directory name of the path | >= 2.0.1 | -| [path.relative](#path-relative) | Convert to relative path | >= 2.0.1 | -| [path.absolute](#path-absolute) | Convert to Absolute Path | >= 2.0.1 | -| [path.is_absolute](#path-is_absolute) | Determine if it is an absolute path | >= 2.0.1 | -| [path.splitenv](#path-splitenv) | Split a envienment variable value of an array of pathes | >= 2.2.7 | +| [path.join](#pathjoin) | Stitching Path | >= 2.0.1 | +| [path.translate](#pathtranslate) | Convert path to the path style of the current platform | >= 2.0.1 | +| [path.basename](#pathbasename) | Get the file name with no suffix at the end | >= 2.0.1 | +| [path.filename](#pathfilename) | Get the file name with the last suffix of the path | >= 2.0.1 | +| [path.extension](#pathextension) | Get the suffix of the path | >= 2.0.1 | +| [path.directory](#pathdirectory) | Get the last directory name of the path | >= 2.0.1 | +| [path.relative](#pathrelative) | Convert to relative path | >= 2.0.1 | +| [path.absolute](#pathabsolute) | Convert to Absolute Path | >= 2.0.1 | +| [path.is_absolute](#pathis_absolute) | Determine if it is an absolute path | >= 2.0.1 | +| [path.splitenv](#pathsplitenv) | Split a envienment variable value of an array of pathes | >= 2.2.7 | #### path.join @@ -1337,7 +1337,7 @@ if path.is_absolute("/tmp/file.txt") then end ``` -###### path.splitenv +#### path.splitenv - Split a envienment variable value of an array of pathes @@ -1364,10 +1364,10 @@ It has been extended in xmake to add some extension interfaces: | Interface | Description | Supported Versions | | ----------------------------------------------- | -------------------------------------------- | -------- | -| [table.join](#table-join) | Merge multiple tables and return | >= 2.0.1 | -| [table.join2](#table-join2) | Merge multiple tables into the first table | >= 2.0.1 | -| [table.unique](#table-unique) | Deduplicate the contents of the table | >= 2.0.1 | -| [table.slice](#table-slice) | Get the slice of the table | >= 2.0.1 | +| [table.join](#tablejoin) | Merge multiple tables and return | >= 2.0.1 | +| [table.join2](#tablejoin2) | Merge multiple tables into the first table | >= 2.0.1 | +| [table.unique](#tableunique) | Deduplicate the contents of the table | >= 2.0.1 | +| [table.slice](#tableslice) | Get the slice of the table | >= 2.0.1 | #### table.join @@ -1439,12 +1439,12 @@ It has been extended in xmake to add some extension interfaces: | Interface | Description | Supported Versions | | ----------------------------------------------- | -------------------------------------------- | -------- | -| [string.startswith](#string-startswith) | Determine if the beginning of the string matches | >= 1.0.1 | -| [string.endswith](#string-endswith) | Determine if the end of the string matches | >= 1.0.1 | -| [string.split](#string-split) | Split String | >= 1.0.1 | -| [string.trim](#string-trim) | Remove the left and right whitespace characters | >= 1.0.1 | -| [string.ltrim](#string-ltrim) | Remove the whitespace character to the left of the string | >= 1.0.1 | -| [string.rtrim](#string-rtrim) | Remove the whitespace character to the right of the string | >= 1.0.1 | +| [string.startswith](#stringstartswith) | Determine if the beginning of the string matches | >= 1.0.1 | +| [string.endswith](#stringendswith) | Determine if the end of the string matches | >= 1.0.1 | +| [string.split](#stringsplit) | Split String | >= 1.0.1 | +| [string.trim](#stringtrim) | Remove the left and right whitespace characters | >= 1.0.1 | +| [string.ltrim](#stringltrim) | Remove the whitespace character to the left of the string | >= 1.0.1 | +| [string.rtrim](#stringrtrim) | Remove the whitespace character to the right of the string | >= 1.0.1 | #### string.startswith @@ -1539,14 +1539,14 @@ The result is: " hello xmake!" ### process -This is the xmake extension's process control module for more flexible control of the process, compared to: [os.run](#os-run) series is more flexible and lower level. +This is the xmake extension's process control module for more flexible control of the process, compared to: [os.run](#osrun) series is more flexible and lower level. | Interface | Description | Supported Versions | | ----------------------------------------------- | -------------------------------------------- | -------- | -| [process.open](#process-open) | Open Process | >= 2.0.1 | -| [process.wait](#process-wait) | Waiting for the process to end | >= 2.0.1 | -| [process.close](#process-close) | Close Process Object | >=2.0.1 | -| [process.waitlist](#process-waitlist) | Waiting for multiple processes at the same time | >= 2.0.1 | +| [process.open](#processopen) | Open Process | >= 2.0.1 | +| [process.wait](#processwait) | Waiting for the process to end | >= 2.0.1 | +| [process.close](#processclose) | Close Process Object | >=2.0.1 | +| [process.waitlist](#processwaitlist) | Waiting for multiple processes at the same time | >= 2.0.1 | #### process.open @@ -1575,13 +1575,13 @@ end - Waiting for the process to end -For specific use, see: [process.open](#process-open) +For specific use, see: [process.open](#processopen) #### process.close - close the process object -For specific use, see: [process.open](#process-open) +For specific use, see: [process.open](#processopen) #### process.waitlist diff --git a/zh-cn/manual/builtin_modules.md b/zh-cn/manual/builtin_modules.md index a0412ffb..d3af45f9 100644 --- a/zh-cn/manual/builtin_modules.md +++ b/zh-cn/manual/builtin_modules.md @@ -69,7 +69,7 @@ target("test") #### 获取内置变量的值 -[内置变量](#内置变量)可以通过此接口直接获取,而不需要再加`$()`的包裹,使用更加简单,例如: +[内置变量](/zh-cn/manual/builtin_variables)可以通过此接口直接获取,而不需要再加`$()`的包裹,使用更加简单,例如: ```lua print(val("host")) @@ -91,7 +91,7 @@ local s = vformat("$(shell echo hello)") import的主要用于导入xmake的扩展类库以及一些自定义的类库模块,一般用于: -* 自定义脚本([on_build](#targeton_build), [on_run](#targeton_run) ..) +* 自定义脚本([on_build](/zh-cn/manual/project_target?id=targeton_build), [on_run](/zh-cn/manual/project_target?id=targeton_run) ..) * 插件开发 * 模板开发 * 平台扩展 @@ -585,7 +585,7 @@ $ xmake --version #### 格式化字符串 -如果只是想格式化字符串,不进行输出,可以使用这个接口,此接口跟[string.format](#string-format)接口等价,只是个接口名简化版。 +如果只是想格式化字符串,不进行输出,可以使用这个接口,此接口跟[string.format](#stringformat)接口等价,只是个接口名简化版。 ```lua local s = format("hello %s", xmake) @@ -617,7 +617,7 @@ if (errors) raise(errors) #### 查找依赖包 -此接口是对[lib.detect.find_package](#detect-find_package)接口的封装,提供多个依赖包的查找支持,例如: +此接口是对[lib.detect.find_package](/zh-cn/manual/extension_modules?id=detectfind_package)接口的封装,提供多个依赖包的查找支持,例如: ```lua target("test") @@ -640,38 +640,38 @@ os模块里面只有部分readonly接口(例如:`os.getenv`, `os.arch`)是 | 接口 | 描述 | 支持版本 | | ----------------------------------------------- | -------------------------------------------- | -------- | -| [os.cp](#os-cp) | 复制文件或目录 | >= 2.0.1 | -| [os.mv](#os-mv) | 移动重命名文件或目录 | >= 2.0.1 | -| [os.rm](#os-rm) | 删除文件或目录树 | >= 2.0.1 | -| [os.trycp](#os-trycp) | 尝试复制文件或目录 | >= 2.1.6 | -| [os.trymv](#os-trymv) | 尝试移动重命名文件或目录 | >= 2.1.6 | -| [os.tryrm](#os-tryrm) | 尝试删除文件或目录树 | >= 2.1.6 | -| [os.cd](#os-cd) | 进入指定目录 | >= 2.0.1 | -| [os.rmdir](#os-rmdir) | 删除目录树 | >= 2.0.1 | -| [os.mkdir](#os-mkdir) | 创建指定目录 | >= 2.0.1 | -| [os.isdir](#os-isdir) | 判断目录是否存在 | >= 2.0.1 | -| [os.isfile](#os-isfile) | 判断文件是否存在 | >= 2.0.1 | -| [os.exists](#os-exists) | 判断文件或目录是否存在 | >= 2.0.1 | -| [os.dirs](#os-dirs) | 遍历获取指定目录下的所有目录 | >= 2.0.1 | -| [os.files](#os-files) | 遍历获取指定目录下的所有文件 | >= 2.0.1 | -| [os.filedirs](#os-filedirs) | 遍历获取指定目录下的所有文件或目录 | >= 2.0.1 | -| [os.run](#os-run) | 安静运行程序 | >= 2.0.1 | -| [os.runv](#os-runv) | 安静运行程序,带参数列表 | >= 2.1.5 | -| [os.exec](#os-exec) | 回显运行程序 | >= 2.0.1 | -| [os.execv](#os-execv) | 回显运行程序,带参数列表 | >= 2.1.5 | -| [os.iorun](#os-iorun) | 运行并获取程序输出内容 | >= 2.0.1 | -| [os.iorunv](#os-iorunv) | 运行并获取程序输出内容,带参数列表 | >= 2.1.5 | -| [os.getenv](#os-getenv) | 获取环境变量 | >= 2.0.1 | -| [os.setenv](#os-setenv) | 设置环境变量 | >= 2.0.1 | -| [os.tmpdir](#os-tmpdir) | 获取临时目录路径 | >= 2.0.1 | -| [os.tmpfile](#os-tmpfile) | 获取临时文件路径 | >= 2.0.1 | -| [os.curdir](#os-curdir) | 获取当前目录路径 | >= 2.0.1 | -| [os.filesize](#os-filesize) | 获取文件大小 | >= 2.1.9 | -| [os.scriptdir](#os-scriptdir) | 获取脚本目录路径 | >= 2.0.1 | -| [os.programdir](#os-programdir) | 获取xmake安装主程序脚本目录 | >= 2.1.5 | -| [os.projectdir](#os-projectdir) | 获取工程主目录 | >= 2.1.5 | -| [os.arch](#os-arch) | 获取当前系统架构 | >= 2.0.1 | -| [os.host](#os-host) | 获取当前主机系统 | >= 2.0.1 | +| [os.cp](#oscp) | 复制文件或目录 | >= 2.0.1 | +| [os.mv](#osmv) | 移动重命名文件或目录 | >= 2.0.1 | +| [os.rm](#osrm) | 删除文件或目录树 | >= 2.0.1 | +| [os.trycp](#ostrycp) | 尝试复制文件或目录 | >= 2.1.6 | +| [os.trymv](#ostrymv) | 尝试移动重命名文件或目录 | >= 2.1.6 | +| [os.tryrm](#ostryrm) | 尝试删除文件或目录树 | >= 2.1.6 | +| [os.cd](#oscd) | 进入指定目录 | >= 2.0.1 | +| [os.rmdir](#osrmdir) | 删除目录树 | >= 2.0.1 | +| [os.mkdir](#osmkdir) | 创建指定目录 | >= 2.0.1 | +| [os.isdir](#osisdir) | 判断目录是否存在 | >= 2.0.1 | +| [os.isfile](#osisfile) | 判断文件是否存在 | >= 2.0.1 | +| [os.exists](#osexists) | 判断文件或目录是否存在 | >= 2.0.1 | +| [os.dirs](#osdirs) | 遍历获取指定目录下的所有目录 | >= 2.0.1 | +| [os.files](#osfiles) | 遍历获取指定目录下的所有文件 | >= 2.0.1 | +| [os.filedirs](#osfiledirs) | 遍历获取指定目录下的所有文件或目录 | >= 2.0.1 | +| [os.run](#osrun) | 安静运行程序 | >= 2.0.1 | +| [os.runv](#osrunv) | 安静运行程序,带参数列表 | >= 2.1.5 | +| [os.exec](#osexec) | 回显运行程序 | >= 2.0.1 | +| [os.execv](#osexecv) | 回显运行程序,带参数列表 | >= 2.1.5 | +| [os.iorun](#osiorun) | 运行并获取程序输出内容 | >= 2.0.1 | +| [os.iorunv](#osiorunv) | 运行并获取程序输出内容,带参数列表 | >= 2.1.5 | +| [os.getenv](#osgetenv) | 获取环境变量 | >= 2.0.1 | +| [os.setenv](#ossetenv) | 设置环境变量 | >= 2.0.1 | +| [os.tmpdir](#ostmpdir) | 获取临时目录路径 | >= 2.0.1 | +| [os.tmpfile](#ostmpfile) | 获取临时文件路径 | >= 2.0.1 | +| [os.curdir](#oscurdir) | 获取当前目录路径 | >= 2.0.1 | +| [os.filesize](#osfilesize) | 获取文件大小 | >= 2.1.9 | +| [os.scriptdir](#osscriptdir) | 获取脚本目录路径 | >= 2.0.1 | +| [os.programdir](#osprogramdir) | 获取xmake安装主程序脚本目录 | >= 2.1.5 | +| [os.projectdir](#osprojectdir) | 获取工程主目录 | >= 2.1.5 | +| [os.arch](#osarch) | 获取当前系统架构 | >= 2.0.1 | +| [os.host](#oshost) | 获取当前主机系统 | >= 2.0.1 | #### os.cp @@ -706,7 +706,7 @@ os.cp("$(curdir)/test/", "$(tmpdir)/test") - 移动重命名文件或目录 -跟[os.cp](#os-cp)的使用类似,同样支持多文件移动操作和模式匹配,例如: +跟[os.cp](#oscp)的使用类似,同样支持多文件移动操作和模式匹配,例如: ```lua -- 移动多个文件到临时目录 @@ -730,7 +730,7 @@ os.rm("$(buildir)/inc/**.h", "$(buildir)/lib/") - 尝试复制文件或目录 -跟[os.cp](#os-cp)类似,唯一的区别就是,此接口操作失败不会抛出异常中断xmake,而是通过返回值标示是否执行成功。 +跟[os.cp](#oscp)类似,唯一的区别就是,此接口操作失败不会抛出异常中断xmake,而是通过返回值标示是否执行成功。 ```lua if os.trycp("file", "dest/file") then @@ -741,7 +741,7 @@ end - 尝试移动文件或目录 -跟[os.mv](#os-mv)类似,唯一的区别就是,此接口操作失败不会抛出异常中断xmake,而是通过返回值标示是否执行成功。 +跟[os.mv](#osmv)类似,唯一的区别就是,此接口操作失败不会抛出异常中断xmake,而是通过返回值标示是否执行成功。 ```lua if os.trymv("file", "dest/file") then @@ -752,7 +752,7 @@ end - 尝试删除文件或目录 -跟[os.rm](#os-rm)类似,唯一的区别就是,此接口操作失败不会抛出异常中断xmake,而是通过返回值标示是否执行成功。 +跟[os.rm](#osrm)类似,唯一的区别就是,此接口操作失败不会抛出异常中断xmake,而是通过返回值标示是否执行成功。 ```lua if os.tryrm("file") then @@ -909,7 +909,7 @@ os.run("ls -l $(buildir)") - 安静运行原生shell命令,带参数列表 -跟[os.run](#os-run)类似,只是传递参数的方式是通过参数列表传递,而不是字符串命令,例如: +跟[os.run](#osrun)类似,只是传递参数的方式是通过参数列表传递,而不是字符串命令,例如: ```lua os.runv("echo", {"hello", "xmake!"}) @@ -919,13 +919,13 @@ os.runv("echo", {"hello", "xmake!"}) - 回显运行原生shell命令 -与[os.run](#os-run)接口类似,唯一的不同是,此接口执行shell程序时,是带回显输出的,一般调试的时候用的比较多 +与[os.run](#osrun)接口类似,唯一的不同是,此接口执行shell程序时,是带回显输出的,一般调试的时候用的比较多 #### os.execv - 回显运行原生shell命令,带参数列表 -跟[os.execv](#os-execv)类似,只是传递参数的方式是通过参数列表传递,而不是字符串命令,例如: +跟[os.execv](#osexecv)类似,只是传递参数的方式是通过参数列表传递,而不是字符串命令,例如: ```lua os.execv("echo", {"hello", "xmake!"}) @@ -935,7 +935,7 @@ os.execv("echo", {"hello", "xmake!"}) - 安静运行原生shell命令并获取输出内容 -与[os.run](#os-run)接口类似,唯一的不同是,此接口执行shell程序后,会获取shell程序的执行结果,相当于重定向输出。 +与[os.run](#osrun)接口类似,唯一的不同是,此接口执行shell程序后,会获取shell程序的执行结果,相当于重定向输出。 可同时获取`stdout`, `stderr`中的内容,例如: @@ -947,7 +947,7 @@ local outdata, errdata = os.iorun("echo hello xmake!") - 安静运行原生shell命令并获取输出内容,带参数列表 -跟[os.iorunv](#os-iorunv)类似,只是传递参数的方式是通过参数列表传递,而不是字符串命令,例如: +跟[os.iorunv](#osiorunv)类似,只是传递参数的方式是通过参数列表传递,而不是字符串命令,例如: ```lua local result, errors = os.iorunv("echo", {"hello", "xmake!"}) @@ -997,7 +997,7 @@ print("$(tmpdir)/file.txt")) 跟[$(curdir)](#var-curdir)结果一致,只不过是直接获取返回一个变量,可以用后续字符串维护。 -用法参考:[os.tmpdir](#os-tmpdir)。 +用法参考:[os.tmpdir](#ostmpdir)。 #### os.filesize @@ -1013,7 +1013,7 @@ print(os.filesize("/tmp/a")) 跟[$(scriptdir)](#var-scriptdir)结果一致,只不过是直接获取返回一个变量,可以用后续字符串维护。 -用法参考:[os.tmpdir](#os-tmpdir)。 +用法参考:[os.tmpdir](#ostmpdir)。 #### os.programdir @@ -1045,16 +1045,16 @@ io操作模块,扩展了lua内置的io模块,提供更多易用的接口。 | 接口 | 描述 | 支持版本 | | ----------------------------------------------- | -------------------------------------------- | -------- | -| [io.open](#io-open) | 打开文件用于读写 | >= 2.0.1 | -| [io.load](#io-load) | 从指定路径文件反序列化加载所有table内容 | >= 2.0.1 | -| [io.save](#io-save) | 序列化保存所有table内容到指定路径文件 | >= 2.0.1 | +| [io.open](#ioopen) | 打开文件用于读写 | >= 2.0.1 | +| [io.load](#ioload) | 从指定路径文件反序列化加载所有table内容 | >= 2.0.1 | +| [io.save](#iosave) | 序列化保存所有table内容到指定路径文件 | >= 2.0.1 | | [io.readfile](#io.readfile) | 从指定路径文件读取所有内容 | >= 2.1.3 | | [io.writefile](#io.writefile) | 写入所有内容到指定路径文件 | >= 2.1.3 | -| [io.gsub](#io-gsub) | 全文替换指定路径文件的内容 | >= 2.0.1 | -| [io.tail](#io-tail) | 读取和显示文件的尾部内容 | >= 2.0.1 | -| [io.cat](#io-cat) | 读取和显示文件的所有内容 | >= 2.0.1 | -| [io.print](#io-print) | 带换行格式化输出内容到文件 | >= 2.0.1 | -| [io.printf](#io-printf) | 无换行格式化输出内容到文件 | >= 2.0.1 | +| [io.gsub](#iogsub) | 全文替换指定路径文件的内容 | >= 2.0.1 | +| [io.tail](#iotail) | 读取和显示文件的尾部内容 | >= 2.0.1 | +| [io.cat](#iocat) | 读取和显示文件的所有内容 | >= 2.0.1 | +| [io.print](#ioprint) | 带换行格式化输出内容到文件 | >= 2.0.1 | +| [io.printf](#ioprintf) | 无换行格式化输出内容到文件 | >= 2.0.1 | #### io.open @@ -1102,7 +1102,7 @@ end - 从指定路径文件反序列化加载所有table内容 -可以从文件中加载序列化好的table内容,一般与[io.save](#io-save)配合使用,例如: +可以从文件中加载序列化好的table内容,一般与[io.save](#iosave)配合使用,例如: ```lua -- 加载序列化文件的内容到table @@ -1118,7 +1118,7 @@ end - 序列化保存所有table内容到指定路径文件 -可以序列化存储table内容到指定文件,一般与[io.load](#io-load)配合使用,例如: +可以序列化存储table内容到指定文件,一般与[io.load](#ioload)配合使用,例如: ```lua io.save("xxx.txt", {a = "a", b = "b", c = "c"}) @@ -1158,7 +1158,7 @@ io.writefile("xxx.txt", "all data") - 全文替换指定路径文件的内容 -类似[string.gsub](#string-gsub)接口,全文模式匹配替换内容,不过这里是直接操作文件,例如: +类似[string.gsub](#stringgsub)接口,全文模式匹配替换内容,不过这里是直接操作文件,例如: ```lua -- 移除文件所有的空白字符 @@ -1212,16 +1212,16 @@ io.printf("xxx.txt", "hello %s!\n", "xmake") | 接口 | 描述 | 支持版本 | | ----------------------------------------------- | -------------------------------------------- | -------- | -| [path.join](#path-join) | 拼接路径 | >= 2.0.1 | -| [path.translate](#path-translate) | 转换路径到当前平台的路径风格 | >= 2.0.1 | -| [path.basename](#path-basename) | 获取路径最后不带后缀的文件名 | >= 2.0.1 | -| [path.filename](#path-filename) | 获取路径最后带后缀的文件名 | >= 2.0.1 | -| [path.extension](#path-extension) | 获取路径的后缀名 | >= 2.0.1 | -| [path.directory](#path-directory) | 获取路径最后的目录名 | >= 2.0.1 | -| [path.relative](#path-relative) | 转换成相对路径 | >= 2.0.1 | -| [path.absolute](#path-absolute) | 转换成绝对路径 | >= 2.0.1 | -| [path.is_absolute](#path-is_absolute) | 判断是否为绝对路径 | >= 2.0.1 | -| [path.splitenv](#path-splitenv) | 分割环境变量中的路径 | >= 2.2.7 | +| [path.join](#pathjoin) | 拼接路径 | >= 2.0.1 | +| [path.translate](#pathtranslate) | 转换路径到当前平台的路径风格 | >= 2.0.1 | +| [path.basename](#pathbasename) | 获取路径最后不带后缀的文件名 | >= 2.0.1 | +| [path.filename](#pathfilename) | 获取路径最后带后缀的文件名 | >= 2.0.1 | +| [path.extension](#pathextension) | 获取路径的后缀名 | >= 2.0.1 | +| [path.directory](#pathdirectory) | 获取路径最后的目录名 | >= 2.0.1 | +| [path.relative](#pathrelative) | 转换成相对路径 | >= 2.0.1 | +| [path.absolute](#pathabsolute) | 转换成绝对路径 | >= 2.0.1 | +| [path.is_absolute](#pathis_absolute) | 判断是否为绝对路径 | >= 2.0.1 | +| [path.splitenv](#pathsplitenv) | 分割环境变量中的路径 | >= 2.2.7 | #### path.join @@ -1339,7 +1339,7 @@ if path.is_absolute("/tmp/file.txt") then end ``` -###### path.splitenv +#### path.splitenv - 分割环境变量中的路径 @@ -1366,10 +1366,10 @@ xmake中对其进行了扩展,增加了一些扩展接口: | 接口 | 描述 | 支持版本 | | ----------------------------------------------- | -------------------------------------------- | -------- | -| [table.join](#table-join) | 合并多个table并返回 | >= 2.0.1 | -| [table.join2](#table-join2) | 合并多个table到第一个table | >= 2.0.1 | -| [table.unique](#table-unique) | 对table中的内容进行去重 | >= 2.0.1 | -| [table.slice](#table-slice) | 获取table的切片 | >= 2.0.1 | +| [table.join](#tablejoin) | 合并多个table并返回 | >= 2.0.1 | +| [table.join2](#tablejoin2) | 合并多个table到第一个table | >= 2.0.1 | +| [table.unique](#tableunique) | 对table中的内容进行去重 | >= 2.0.1 | +| [table.slice](#tableslice) | 获取table的切片 | >= 2.0.1 | #### table.join @@ -1441,12 +1441,12 @@ xmake中对其进行了扩展,增加了一些扩展接口: | 接口 | 描述 | 支持版本 | | ----------------------------------------------- | -------------------------------------------- | -------- | -| [string.startswith](#string-startswith) | 判断字符串开头是否匹配 | >= 1.0.1 | -| [string.endswith](#string-endswith) | 判断字符串结尾是否匹配 | >= 1.0.1 | -| [string.split](#string-split) | 分割字符串 | >= 1.0.1 | -| [string.trim](#string-trim) | 去掉字符串左右空白字符 | >= 1.0.1 | -| [string.ltrim](#string-ltrim) | 去掉字符串左边空白字符 | >= 1.0.1 | -| [string.rtrim](#string-rtrim) | 去掉字符串右边空白字符 | >= 1.0.1 | +| [string.startswith](#stringstartswith) | 判断字符串开头是否匹配 | >= 1.0.1 | +| [string.endswith](#stringendswith) | 判断字符串结尾是否匹配 | >= 1.0.1 | +| [string.split](#stringsplit) | 分割字符串 | >= 1.0.1 | +| [string.trim](#stringtrim) | 去掉字符串左右空白字符 | >= 1.0.1 | +| [string.ltrim](#stringltrim) | 去掉字符串左边空白字符 | >= 1.0.1 | +| [string.rtrim](#stringrtrim) | 去掉字符串右边空白字符 | >= 1.0.1 | #### string.startswith @@ -1545,14 +1545,14 @@ string.rtrim(" hello xmake! ") ### process -这个是xmake扩展的进程控制模块,用于更加灵活的控制进程,比起:[os.run](#os-run)系列灵活性更高,也更底层。 +这个是xmake扩展的进程控制模块,用于更加灵活的控制进程,比起:[os.run](#osrun)系列灵活性更高,也更底层。 | 接口 | 描述 | 支持版本 | | ----------------------------------------------- | -------------------------------------------- | -------- | -| [process.open](#process-open) | 打开进程 | >= 2.0.1 | -| [process.wait](#process-wait) | 等待进程结束 | >= 2.0.1 | -| [process.close](#process-close) | 关闭进程对象 | >= 2.0.1 | -| [process.waitlist](#process-waitlist) | 同时等待多个进程 | >= 2.0.1 | +| [process.open](#processopen) | 打开进程 | >= 2.0.1 | +| [process.wait](#processwait) | 等待进程结束 | >= 2.0.1 | +| [process.close](#processclose) | 关闭进程对象 | >= 2.0.1 | +| [process.waitlist](#processwaitlist) | 同时等待多个进程 | >= 2.0.1 | #### process.open @@ -1581,13 +1581,13 @@ end - 等待进程结束 -具体使用见:[process.open](#process-open) +具体使用见:[process.open](#processopen) #### process.close - 关闭进程对象 -具体使用见:[process.open](#process-open) +具体使用见:[process.open](#processopen) #### process.waitlist |
