mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-01-27 09:24:47 +00:00
commit
2bc72a883f
@ -31,6 +31,7 @@ New Features in ComputerCraft 1.80:
|
|||||||
* shell.resolveProgram now picks up on *.lua files
|
* shell.resolveProgram now picks up on *.lua files
|
||||||
* Fixed a handful of bugs in ComputerCraft
|
* Fixed a handful of bugs in ComputerCraft
|
||||||
* Added speaker block, turtle upgrade, pocket upgrade, and peripheral api
|
* Added speaker block, turtle upgrade, pocket upgrade, and peripheral api
|
||||||
|
* Startup can now be a directory containing multiple startup files
|
||||||
|
|
||||||
New Features in ComputerCraft 1.79:
|
New Features in ComputerCraft 1.79:
|
||||||
|
|
||||||
|
@ -31,5 +31,6 @@ New Features in ComputerCraft 1.80:
|
|||||||
* shell.resolveProgram now picks up on *.lua files
|
* shell.resolveProgram now picks up on *.lua files
|
||||||
* Fixed a handful of bugs in ComputerCraft
|
* Fixed a handful of bugs in ComputerCraft
|
||||||
* Added speaker block, turtle upgrade, pocket upgrade, and peripheral api
|
* Added speaker block, turtle upgrade, pocket upgrade, and peripheral api
|
||||||
|
* Startup can now be a directory containing multiple startup files
|
||||||
|
|
||||||
Type "help changelog" to see the full version history.
|
Type "help changelog" to see the full version history.
|
||||||
|
@ -209,22 +209,47 @@ if fs.exists( "/rom/autorun" ) and fs.isDir( "/rom/autorun" ) then
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function findStartups( sBaseDir )
|
||||||
|
local tStartups = nil
|
||||||
|
local sBasePath = "/" .. fs.combine( sBaseDir, "startup" )
|
||||||
|
local sStartupNode = shell.resolveProgram( sBasePath )
|
||||||
|
if sStartupNode then
|
||||||
|
tStartups = { sStartupNode }
|
||||||
|
end
|
||||||
|
-- It's possible that there is a startup directory and a startup.lua file, so this has to be
|
||||||
|
-- executed even if a file has already been found.
|
||||||
|
if fs.isDir( sBasePath ) then
|
||||||
|
if tStartups == nil then
|
||||||
|
tStartups = {}
|
||||||
|
end
|
||||||
|
for _,v in pairs( fs.list( sBasePath ) ) do
|
||||||
|
local sPath = "/" .. fs.combine( sBasePath, v )
|
||||||
|
if not fs.isDir( sPath ) then
|
||||||
|
tStartups[ #tStartups + 1 ] = sPath
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return tStartups
|
||||||
|
end
|
||||||
|
|
||||||
-- Run the user created startup, either from disk drives or the root
|
-- Run the user created startup, either from disk drives or the root
|
||||||
local sUserStartup = nil
|
local tUserStartups = nil
|
||||||
if settings.get( "shell.allow_startup" ) then
|
if settings.get( "shell.allow_startup" ) then
|
||||||
sUserStartup = shell.resolveProgram( "/startup" )
|
tUserStartups = findStartups( "/" )
|
||||||
end
|
end
|
||||||
if settings.get( "shell.allow_disk_startup" ) then
|
if settings.get( "shell.allow_disk_startup" ) then
|
||||||
for n,sName in pairs( peripheral.getNames() ) do
|
for n,sName in pairs( peripheral.getNames() ) do
|
||||||
if disk.isPresent( sName ) and disk.hasData( sName ) then
|
if disk.isPresent( sName ) and disk.hasData( sName ) then
|
||||||
local sDiskStartup = shell.resolveProgram( "/" .. disk.getMountPath( sName ) .. "/startup" )
|
local startups = findStartups( disk.getMountPath( sName ) )
|
||||||
if sDiskStartup then
|
if startups then
|
||||||
sUserStartup = sDiskStartup
|
tUserStartups = startups
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if sUserStartup then
|
if tUserStartups then
|
||||||
shell.run( sUserStartup )
|
for _,v in pairs( tUserStartups ) do
|
||||||
|
shell.run( v )
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user