Fix last __dirname and __filename usages

This commit is contained in:
Willy-JL
2024-11-02 04:02:08 +00:00
parent 3ea2ace360
commit 87ef8772c2
2 changed files with 8 additions and 8 deletions

View File

@@ -2,16 +2,16 @@ let widget = require("widget");
let demo_seconds = 30;
print("Loading file", __filepath);
print("From directory", __dirpath);
print("Loading file", __filename);
print("From directory", __dirname);
// addText supports "Primary" and "Secondary" font sizes.
widget.addText(10, 10, "Primary", "Example JS widget");
widget.addText(10, 20, "Secondary", "Example widget from JS!");
// load a Xbm file from the same directory as this script.
widget.addText(0, 30, "Secondary", __filepath);
let logo = widget.loadImageXbm(__dirpath + "/widget-js.fxbm");
widget.addText(0, 30, "Secondary", __filename);
let logo = widget.loadImageXbm(__dirname + "/widget-js.fxbm");
// add a line (x1, y1, x2, y2)
widget.addLine(10, 35, 120, 35);

View File

@@ -73,18 +73,18 @@ Transforms a string to lower case.
toLowerCase("Example") // "example"
```
## __dirpath
## __dirname
Path to the directory containing the current script.
### Examples:
```js
print(__dirpath); // /ext/apps/Scripts/Examples
print(__dirname); // /ext/apps/Scripts/Examples
```
## __filepath
## __filename
Path to the current script file.
### Examples:
```js
print(__filepath); // /ext/apps/Scripts/Examples/path.js
print(__filename); // /ext/apps/Scripts/Examples/path.js
```