ID:144566
 
Code:
for(file(var/G as file|null,"archive/[G]"))
fcopy(G)
AddFile(G)


Problem description:
uhm. im rely sick. any help would help.

for(var/F in flist("archieve/"))world<<F


This would output the file names in that directory as text, to convert it to a file (per say), I recommand file() >_> But I am tired so I dunno.. >.>

- GhostAnime
In response to GhostAnime
for(var/F in flist("archive/"))
world<<F
fcopy(F,"archive/")
AddFile(F,"server")

// ok so the only prob is that it keeps adding on - i need it to prevent it form doing the same files over and over again

var/W
proc
AddFile(FILE, owner)
for(W in flist("archive/"))
fcopy(W,"archive/")
if(findtext(W,FILE)) return

ASSERT(FILE && owner && istext(owner))
if(!Files)
Files=list()
Files[owner]=list()
else if(!Files[owner]) Files[owner]=list()
Files[owner]+=FILE
Files[owner][FILE]=FileSize(FILE)

// so i tried to see if it had the same name but i think im doing it wrong. im sick.
In response to Drakiel
for(W in flist("archive/"))
fcopy(W,"archive/")
if(findtext(W,FILE)) return


Use

if("[FILE]" in flist("archive")) return
In response to CaptFalcon33035
im workin off your stuff capt.
Download_File()

for(var/F in flist("archive/"))
AddFile(F,"server")

if(!Files) {src<<"@@ Their are no files to download. @@"; return}
var/html={"<html><head>[CSS]<title>Download File</title></head>
<body bgcolor="#111111" text=white><TABLE BORDER=0 COLS=1 ROWS=2 WIDTH=100%>
<TR><TD CLASS=header>File Name</TD><TD CLASS=header>File Size</TD><TD CLASS=header>
File Owner</TD></TR>"}

for(var/F in Files)
for(var/I in Files[F])
html+={"<TR><TD CLASS=content>
<a href="?file=1;owner=
[F];name=[I];download=1">[I] \[Link]</a></TD>
<TD CLASS=content>
[Files[F][I]]</TD><TD CLASS=content>[F]</TD></TR>"}
html+="</TABLE></body></html>"
src<<browse(html,"window=file;size=400x300")

// so it displays all the files in the folder but everytime i click it - it keeps adding more and more rows of those same files.

proc
AddFile(FILE, owner)

if("[FILE]" in flist("archive")) return

ASSERT(FILE && owner && istext(owner))
if(!Files)
Files=list()
Files[owner]=list()
else if(!Files[owner]) Files[owner]=list()
Files[owner]+=FILE
Files[owner][FILE]=FileSize(FILE)
world<<"@@ [owner] has uploaded [FILE]. @@"

//it should return if the same file is being added, wtf is going on.
In response to Drakiel
I should have used datums in there. Instead, I abused the associative list. If you want to see if a file exists, you will have to loop through all of the people to see.

Of course, you could fcopy() the data to a subfolder of the game onto your computer. With that system, it's just located to the game's rsc file.

proc/FileExists(var/FILE)
if(!FILE) return
for(var/R in Files) if(FILE in R) return 1
return 0


I would rewrite that system for datums. I can help you do it after school. It's Friday! w00t!