Skip to content
Open
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
4 changes: 2 additions & 2 deletions docs/api/description/global-interfaces.md
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ add_moduledirs(dirs: <string|array>, ...)
The builtin modules are placed in the 'xmake/modules' directory, but for user-defined modules for a specific project, you can configure additional module directories in the 'xmake.lua` file.

```lua
add_moduledirs("$(projectdir)/modules")
add_moduledirs(os.projectdir() .. "/modules")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For better cross-platform compatibility and code clarity when constructing paths, it's recommended to use path.join() instead of string concatenation. This ensures that the correct path separator is used regardless of the operating system.

Suggested change
add_moduledirs(os.projectdir() .. "/modules")
add_moduledirs(path.join(os.projectdir(), "modules"))

```
xmake will load the given module in the given directory when calling [`import`](/api/scripts/builtin-modules/import).

Expand Down Expand Up @@ -373,7 +373,7 @@ add_plugindirs(dirs: <string|array>, ...)
The builtin plugins are placed in the 'xmake/plugins' directory, but for user-defined plugins for a specific project, you can configure additional plugin directories in the 'xmake.lua` file.

```lua
add_plugindirs("$(projectdir)/plugins")
add_plugindirs(os.projectdir() .. "/plugins")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For better cross-platform compatibility and code clarity when constructing paths, it's recommended to use path.join() instead of string concatenation. This ensures that the correct path separator is used regardless of the operating system.

Suggested change
add_plugindirs(os.projectdir() .. "/plugins")
add_plugindirs(path.join(os.projectdir(), "plugins"))

```
xmake will load all plugins in the given directory.

Expand Down