Skip to content

Commit baef580

Browse files
unity-cli@v1.6.3
- added `editor-logs` command to print the path to the unity editor logs directory - updated docs
1 parent da4262c commit baef580

5 files changed

Lines changed: 39 additions & 3 deletions

File tree

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ A powerful command line utility for the Unity Game Engine. Automate Unity projec
1414
- [License Version](#license-version)
1515
- [Activate License](#activate-license)
1616
- [Return License](#return-license)
17+
- [License Context](#license-context)
18+
- [Licensing Logs](#licensing-logs)
1719
- [Unity Hub](#unity-hub)
1820
- [Hub Version](#hub-version)
1921
- [Hub Path](#hub-path)
@@ -26,6 +28,7 @@ A powerful command line utility for the Unity Game Engine. Automate Unity projec
2628
- [Create Unity Project](#create-unity-project)
2729
- [Open Unity Project](#open-unity-project)
2830
- [Run Unity Editor Commands](#run-unity-editor-commands)
31+
- [Unity Editor Logs](#unity-editor-logs)
2932
- [Unity Package Manager](#unity-package-manager)
3033
- [Sign a Unity Package](#sign-a-unity-package)
3134
- [Logging](#logging)
@@ -294,6 +297,14 @@ unity-cli open-project
294297
unity-cli run --unity-project <path-to-project> -quit -batchmode -executeMethod StartCommandLineBuild
295298
```
296299

300+
#### Unity Editor Logs
301+
302+
`editor-logs`: Prints the path to the Unity Editor log files.
303+
304+
```bash
305+
unity-cli editor-logs
306+
```
307+
297308
#### Unity Package Manager
298309

299310
##### Sign a Unity Package

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@rage-against-the-pixel/unity-cli",
3-
"version": "1.6.2",
3+
"version": "1.6.3",
44
"description": "A command line utility for the Unity Game Engine.",
55
"author": "RageAgainstThePixel",
66
"license": "MIT",

src/cli.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -688,6 +688,14 @@ program.command('open-project')
688688
}
689689
});
690690

691+
program.command('editor-logs')
692+
.description('Prints the path to the Unity Editor log files.')
693+
.action(async (options) => {
694+
const unityEditorLogsPath = UnityEditor.GetEditorLogsDirectory();
695+
process.stdout.write(`${unityEditorLogsPath}\n`);
696+
process.exit(0);
697+
});
698+
691699
program.commandsGroup("Unity Package Manager:");
692700

693701
program.command('sign-package')

src/unity-editor.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,23 @@ export class UnityEditor {
446446
return editorRootPath;
447447
}
448448

449+
/**
450+
* Gets the path to the Unity Editor log directory.
451+
* @returns The path to the Unity Editor logs directory.
452+
*/
453+
static GetEditorLogsDirectory() {
454+
switch (process.platform) {
455+
case 'darwin':
456+
return path.join(process.env.HOME || '', 'Library', 'Logs', 'Unity');
457+
case 'linux':
458+
return path.join(process.env.HOME || '', '.config', 'unity3d', 'Editor');
459+
case 'win32':
460+
return path.join(process.env.LOCALAPPDATA || '', 'Unity', 'Editor');
461+
default:
462+
throw new Error(`Unsupported platform: ${process.platform}`);
463+
}
464+
}
465+
449466
/**
450467
* Uninstall the Unity Editor.
451468
*/

0 commit comments

Comments
 (0)