Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document os.rename and os.getenv APIs #2252

Merged
merged 3 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions website/docs/os.getenv.md
Original file line number Diff line number Diff line change
@@ -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
```
36 changes: 36 additions & 0 deletions website/docs/os.rename.md
tritao marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -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.
tritao marked this conversation as resolved.
Show resolved Hide resolved
`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
```
2 changes: 2 additions & 0 deletions website/sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,7 @@ module.exports = {
'os.findlib',
'os.get',
'os.getcwd',
'os.getenv',
'os.getnumcpus',
'os.getpass',
'os.getversion',
Expand All @@ -400,6 +401,7 @@ module.exports = {
'os.pathsearch',
'os.realpath',
'os.remove',
'os.rename',
'os.rmdir',
'os.stat',
'os.target',
Expand Down