export HOME as an environment variable in player init script

This commit is contained in:
Ritchie 2024-02-01 00:04:37 -05:00
parent efd17907a0
commit 200011084e
5 changed files with 167 additions and 46 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -24,5 +24,15 @@ fi
# set the prompt as an environment variable
export PS1
# Set the environment variable for the user's home directory.
if [ "$(whoami)" = "root" ]
then
HOME="/root"
else
HOME="/home/$(whoami)"
fi
export HOME;
# set PATH
export PATH='/bin:/sbin:/usr/bin:/usr/sbin'

View file

@ -73,6 +73,40 @@ namespace Core.Scripting
{
switch (name)
{
case "pwd":
{
console.WriteText(process.WorkingDirectory + Environment.NewLine);
return true;
}
case "cd":
{
if (args.Length == 0)
{
process.WorkingDirectory = process.User.Home;
return true;
}
string relativePath = string.Join(" ", args);
string fullPath = ShellUtility.MakeAbsolutePath(PathUtility.Combine(process.WorkingDirectory, relativePath), process.User.Home);
IVirtualFileSystem vfs = process.User.Computer.GetFileSystem(process.User);
if (vfs.FileExists(fullPath))
{
console.WriteText($"-sh: cd: {fullPath}: Not a directory.{Environment.NewLine}");
}
else if (!vfs.DirectoryExists(fullPath))
{
console.WriteText($"-sh: cd: {fullPath}: No such file or directory.{Environment.NewLine}");
}
else
{
process.WorkingDirectory = fullPath;
}
return true;
}
case "export":
if (args.Length == 1)
{

View file

@ -119,7 +119,7 @@ MonoBehaviour:
m_MinSize: {x: 300, y: 200}
m_MaxSize: {x: 24288, y: 16192}
vertical: 0
controlID: 73
controlID: 62
--- !u!114 &6
MonoBehaviour:
m_ObjectHideFlags: 52
@ -144,7 +144,7 @@ MonoBehaviour:
m_MinSize: {x: 200, y: 200}
m_MaxSize: {x: 16192, y: 16192}
vertical: 1
controlID: 74
controlID: 63
--- !u!114 &7
MonoBehaviour:
m_ObjectHideFlags: 52
@ -169,7 +169,7 @@ MonoBehaviour:
m_MinSize: {x: 200, y: 100}
m_MaxSize: {x: 16192, y: 8096}
vertical: 0
controlID: 20
controlID: 64
--- !u!114 &8
MonoBehaviour:
m_ObjectHideFlags: 52
@ -189,8 +189,8 @@ MonoBehaviour:
y: 0
width: 726
height: 1334
m_MinSize: {x: 200, y: 200}
m_MaxSize: {x: 4000, y: 4000}
m_MinSize: {x: 201, y: 221}
m_MaxSize: {x: 4001, y: 4021}
m_ActualView: {fileID: 13}
m_Panes:
- {fileID: 13}
@ -242,8 +242,8 @@ MonoBehaviour:
y: 1334
width: 2932
height: 672
m_MinSize: {x: 100, y: 100}
m_MaxSize: {x: 4000, y: 4000}
m_MinSize: {x: 101, y: 121}
m_MaxSize: {x: 4001, y: 4021}
m_ActualView: {fileID: 16}
m_Panes:
- {fileID: 15}
@ -270,8 +270,8 @@ MonoBehaviour:
y: 0
width: 908
height: 2006
m_MinSize: {x: 275, y: 50}
m_MaxSize: {x: 4000, y: 4000}
m_MinSize: {x: 276, y: 71}
m_MaxSize: {x: 4001, y: 4021}
m_ActualView: {fileID: 18}
m_Panes:
- {fileID: 18}
@ -404,7 +404,7 @@ MonoBehaviour:
scrollPos: {x: 0, y: 0}
m_SelectedIDs:
m_LastClickedID: 0
m_ExpandedIDs: 10fbffff
m_ExpandedIDs: 34fbffff
m_RenameOverlay:
m_UserAcceptedRename: 0
m_Name:
@ -823,7 +823,7 @@ MonoBehaviour:
scrollPos: {x: 0, y: 153}
m_SelectedIDs: 8a830000
m_LastClickedID: 33674
m_ExpandedIDs: 000000003c720000
m_ExpandedIDs: 0000000002720000
m_RenameOverlay:
m_UserAcceptedRename: 0
m_Name:
@ -851,7 +851,7 @@ MonoBehaviour:
scrollPos: {x: 0, y: 0}
m_SelectedIDs:
m_LastClickedID: 0
m_ExpandedIDs: 000000003c720000
m_ExpandedIDs: 0000000002720000
m_RenameOverlay:
m_UserAcceptedRename: 0
m_Name: