--Escritorio


function escritorio()

if #workDir==0 then posicionamiento=lugar workDir = files.list(files.nofile(lugar)) end

lugar=files.nofile(workDir[1].name)

if controls.press("circle") then 
	propi=false
	tareas_e=false
	nuevo=false
	opndcon=false
end

posicion=0
if #workDir<=12 then limite=#workDir else limite=12 end

for w=1,limite do
	if col(p,tables[w]) then posicion=w end
	if modo==1 then icons[tables[w].i]:blit(tables[w].x,tables[w].y+5) end
	if posicion==w then
		if #files.nopath(workDir[w].name)<=14 then 
			screen.print(pspfont,tables[w].x+tables[w].w/2-10,tables[w].y+55,files.nopath(workDir[w].name),0.85,azul,0,"center")
		else
			screen.print(pspfont,tables[w].x+tables[w].w/2,tables[w].y+55,string.sub(files.nopath(workDir[w].name),1,14).."...",0.85,azul,0,"center")
		end
	else
		if #files.nopath(workDir[w].name)<=14 then 
			screen.print(pspfont,tables[w].x+tables[w].w/2-10,tables[w].y+55,files.nopath(workDir[w].name),0.8,rojo,0,"center")
		else
			screen.print(pspfont,tables[w].x+tables[w].w/2,tables[w].y+55,string.sub(files.nopath(workDir[w].name),1,14).."...",0.8,rojo,0,"center")
		end
	end
end

if cuadrado_ini.e==0 and not apagado then
	if not propi and not nuevo and  not tareas_e then
		if controls.press("r") and posicion>0 then
			abrir_barra()
		end
		if controls.press("cross") and posicion!=0 then 
			if workDir[posicion].directory then	
				adelante()
			elseif files.ext(workDir[posicion].name)=="satd" then 
				ruta=ini.read(workDir[posicion].name,"Ruta","Nd") 
				if #files.list(ruta)>0 then
					workDir=files.list(ruta)
					explorador()
				else
					vac()
				end
			elseif files.ext(workDir[posicion].name)=="zip" then
				zip_exing=files.nofile(workDir[posicion].name)
				explorador_zip() 
			elseif files.ext(workDir[posicion].name)=="app" then 
				appa=tonumber(ini.read(workDir[posicion].name,"app","1"))
				if appa!=nil then
					runapp(appa/8-5)
				end
			end
		end
	end
end

if pos_tarea!=0 then
	propiedades(true)
	new_file(1)
	abrir_con()
	tareas(1)
end

end

