diff --git a/website/docs/os.getenv.md b/website/docs/os.getenv.md new file mode 100644 index 000000000..37fdd19de --- /dev/null +++ b/website/docs/os.getenv.md @@ -0,0 +1,25 @@ +Gets the value of an environment variable from the host system. + +```lua +id = os.getenv(var) +``` + +### Parameters ### + +`var` Environment variable name. + +### Return Value ### + +Returns the value of the environment variable if one is set, or nil. + +### Availability ### + +Premake 4.0 or later. + +### Examples ### + +```lua +if os.getenv('FOO') == "bar" then + -- do something specific when FOO=bar +end +``` diff --git a/website/docs/os.rename.md b/website/docs/os.rename.md new file mode 100644 index 000000000..24916c3ce --- /dev/null +++ b/website/docs/os.rename.md @@ -0,0 +1,36 @@ +Rename file system files or directories. + +```lua +os.rename("path", "newpath") +``` + +### Parameters ### + +`path` is the file system path to be renamed. +`newpath` is the renamed file system path. + + +### Return Value ### + +True if successful, otherwise nil and an error message. + + +### Availability ### + +Premake 5.0 or later. + + +### See Also ### + +* [os.rmdir](os.rmdir.md) +* [os.matchfiles](os.matchfiles.md) + + +### Examples ### + +```lua +local ok, err = os.rename{"file.bak", "file.log"} +if not ok then + error(err) +end +``` diff --git a/website/sidebars.js b/website/sidebars.js index b9e819693..289287db9 100644 --- a/website/sidebars.js +++ b/website/sidebars.js @@ -383,6 +383,7 @@ module.exports = { 'os.findlib', 'os.get', 'os.getcwd', + 'os.getenv', 'os.getnumcpus', 'os.getpass', 'os.getversion', @@ -400,6 +401,7 @@ module.exports = { 'os.pathsearch', 'os.realpath', 'os.remove', + 'os.rename', 'os.rmdir', 'os.stat', 'os.target',