This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
makerimages's profile picture

copy failed

Started by makerimages, 23 September 2012 - 08:14 AM
makerimages #1
Posted 23 September 2012 - 10:14 AM

term.clear()
textutils.slowPrint("-----------",10)
term.clear()
print("Dear user, welcome to the installation process of makerOS!")
sleep(5)
print("You will now bw guided trough the installation process of your brand new makerOS release!")
sleep(5)
term.clear()
os.loadAPI("/disk/APIS/menus")
menus.inMenu()
menus.selection()

local input = read() 
if input == "1" then 
fs.copy("/disk/OS/mOSsup","startup")
fs.copy("/disk/OS/mOS","/mOS/OS")
fs.copy("/APIS/mOSapi","/APIS/mOSapi")
print("please remove disk and reboot computer!")
elseif input == "2" then
print("Installation cancelled by user,rebooting")
sleep(4)
os.reboot()
else
  print("Invalid selection, please try again")
  sleep(4)
  os.reboot() 
end

somehow on line 16 this says that copy failed, whats wrong(the filepaths are not wrong i checked)
Kolpa #2
Posted 23 September 2012 - 10:21 AM
i never used fs.copy() but i would check if the /mOS/ folder exists
makerimages #3
Posted 23 September 2012 - 10:25 AM
thats supposed to be created by the program
Cloudy #4
Posted 23 September 2012 - 11:31 AM
There is nothing in your code which creates the folder. How do you expect it to be created?

In addition, this line of code makes no sense:
fs.copy("/APIS/mOSapi","/APIS/mOSapi")
You're copying a file to the same location as it is right now.
Kolpa #5
Posted 23 September 2012 - 11:37 AM
There is nothing in your code which creates the folder. How do you expect it to be created?

In addition, this line of code makes no sense:
fs.copy("/APIS/mOSapi","/APIS/mOSapi")
You're copying a file to the same location as it is right now.
well i suppose thanks for doing my job :P/>/>
makerimages #6
Posted 23 September 2012 - 01:10 PM
There is nothing in your code which creates the folder. How do you expect it to be created?

In addition, this line of code makes no sense:
fs.copy("/APIS/mOSapi","/APIS/mOSapi")
You're copying a file to the same location as it is right now.

thats my bad there, dunno how i missed that, but what function creates a folder then??
sjele #7
Posted 23 September 2012 - 01:11 PM

fs.makeDir("path/to/place")
makerimages #8
Posted 23 September 2012 - 01:14 PM
thanks
makerimages #9
Posted 23 September 2012 - 05:15 PM
i dont want to make a another thread, but:




--[[Copyright Makerimages, all of the code here was made by makerimages and you may not distribute this code without written premission]]--

function Logo()
print(" __  __       _              ____   _____")
print("|  /  |     | |            / __  / ____|")
print("|   / | __ _| | _____ _ __| |  | | (___  ")
print("| |/| |/ _` | |/ / _ | '__| |  | |___  ")
print("| |  | | (_| |   |  __| |  | |__| |____) | ")
print("|_|  |_|__,_|_|____|_|   ____/|_____/ ")
end

function Logosplash()
randomSplash = {
"Now with the amazing resolution of "..screen.sizeX.."x"..screen.sizeY.."!!!",
"More Lua than in LUALAND",
"All done in Lua!",
"Youre pointless!",
"Why to bother reading?",
"New feature-BUGS!",
}
 term.write(randomSplash[math.random(table.getn(randomSplash))])
end
end 



says that on line 23 a eof is aspected

and:




--[[Copyright Makerimages, all of the code here was made by makerimages and you may not distribute this code without written premission]]--

os.loadAPI("/APIS/mOSapi")
mOSapi.Logo()
mOSapi.Logosplash()
sleep(5)
clear()
textutils.slowPrint("Loading operating system","3","center")
clear()
textutils.slowPrint("Please Log into makerOS","3","center")

shell.run("/mOS/OS")



sasys that on line 4 attempt to index ? (a nil value)

how to fix them?
MysticT #10
Posted 23 September 2012 - 05:45 PM
1. Remove the last end, it's not needed there.
2. It looks like the api is not loaded. Maybe there's an error in the api. You should always check if the api is loaded:

os.loadAPI("/apis/myApi")
if not myApi then
  error("Error loading api")
end
Anonomit #11
Posted 23 September 2012 - 06:10 PM
makerimages, It might be easier to use a multi-line print in your Logo() function.
Sometimes it makes it easier to see how it will look on the screen.



function Logo()
print[[
__  __	   _			  ____   _____
|  /  |	 | |			/ __  / ____|
|   / | __ _| | _____ _ __| |  | | (___
| |/| |/ _` | |/ / _ | '__| |  | |___ 
| |  | | (_| |   |  __| |  | |__| |____) |
|_|  |_|__,_|_|____|_|   ____/|_____/
]]
end

ChaddJackson12 #12
Posted 26 September 2012 - 03:00 PM
Here's something that I think has to happen, and this might help you quite a bit. You have to make a directory for copying files. You can't copy a file to a nonexistent directory. Or at least it hasn't worked for me. Good luck.