Scolring - Forum

Entraides et échanges autour de la technologie Scol - Informations and exchanges on the Scol technology

Vous pouvez changer la langue de l'interface une fois inscrit - You can change the language once registered

You are not logged in.

#1 16-Dec-2014 22:29:14

hebdemnobad
Member
From: northamerica
Registered: 20-Apr-2011
Posts: 1,477
Website

code problem with listing contents of the cache partition

colleagues:

i am trying to have the vm get a list of files in the cache partition, once _cacheActivate is called. however, all I am getting returned is nil, if _cacheActivate is not called, the main function returns the filenames over every single file in my user partition....so there is something I must not be doing right in terms of the correct path setting in the cache or something else. if i knew, i wouldn't be asking. smile

fun listcat (p, q)=

  if p==nil

  then

    q

  else let p -> [h nxt] in

    h::listcat nxt q;;
    
    
    fun secureLoad(pack)=

  let _testpak pack -> ret in

  if (ret == nil) then

  (

    _fooS "xmlparser loading";

    _load pack;

    1;

  )

  else

  (

    _fooS strcat "Error in " ret;

  

   0;

  );;
  fun load_dependencies(parameter) =
let "locked/lib/_mlistlib.pkg"::nil -> list_of_dependencies in
(
		while (list_of_dependencies!= nil)&& (secureLoad hd list_of_dependencies) do
				(
					set list_of_dependencies = tl list_of_dependencies;
					_fooS "dependencies loading";
				);
		//all dependencies have been read
		if list_of_dependencies==nil then
  				(
  				
  							_fooS "done with  dependency loading";
  
  				0;
  				) 
  		else
  				(
  							_fooS "error in dependency loading";
  				0;
  				);
);
0;;
// Takes a list of directories to scan. The second argument should be 'nil'.
// fun [[S r1] [S r1]] [S r1]
fun getFilesInFolder (lDir, out)=
	if lDir == nil then
		out
	else
		let _listofsubdir hd lDir -> reps in
		let _listoffiles hd lDir -> files in
		(
		if reps != nil then set out = listcat getFilesInFolder reps nil out else nil;
		set out = listcat files out;
		getFilesInFolder tl lDir out
		);;

fun main ()=
	_cacheActivate; 
	_showconsole;
	_fooSList getFilesInFolder "" :: nil nil;
	0;;

thx for your help!
-h

Offline

#2 17-Dec-2014 10:50:46

iri
Admin. / Scol language & Scol apps developer
From: France
Registered: 22-Feb-2009
Posts: 2,024
Website

Re: code problem with listing contents of the cache partition

As Arkeon said, when the Cache is activated, only the "public" directory (and its sub-directories) is available for your job.
Try to create a "public" directory in your Cache and copy it any files. Relaunch your code, it'll work.
However, why do you want browse the Cache directory ? The local os3d project files aren't saved at this place.


This limitation may be too much excessive ? Arkeon, Bob ? What is your opinion?
This prevents a reading from an other network application.

Offline

#3 17-Dec-2014 14:00:34

hebdemnobad
Member
From: northamerica
Registered: 20-Apr-2011
Posts: 1,477
Website

Re: code problem with listing contents of the cache partition

Thx Iri.  I guess scol could create a public directory in the cache when none exists yet . I want my modded player to be able to browse through a list of downloaded .pak files for when the user does not have an Internet connection.

Last edited by hebdemnobad (17-Dec-2014 14:58:22)

Offline

#4 17-Dec-2014 14:32:57

iri
Admin. / Scol language & Scol apps developer
From: France
Registered: 22-Feb-2009
Posts: 2,024
Website

Re: code problem with listing contents of the cache partition

fun main ()=
	_showconsole;
	_cacheActivate;
	_fooId _createpack "toto" _getmodifypack "public/test.txt";
	0;;

If no "public" directory exists, it will be created.

Offline

#5 17-Dec-2014 14:34:12

iri
Admin. / Scol language & Scol apps developer
From: France
Registered: 22-Feb-2009
Posts: 2,024
Website

Re: code problem with listing contents of the cache partition

Remarks that _deletepack works in the same directory, if the Cache is activated. { it's wrong }

Offline

#6 17-Dec-2014 14:58:06

hebdemnobad
Member
From: northamerica
Registered: 20-Apr-2011
Posts: 1,477
Website

Re: code problem with listing contents of the cache partition

thx iri...i see now that the 'public' directory is located in:
C:\Users\hebdemnobad\AppData\Local\Scol Voyager\Cache
...i thought it was located in
C:\Users\hebdemnobad\AppData\Local\Scol Voyager\

Offline

#7 17-Dec-2014 15:15:36

iri
Admin. / Scol language & Scol apps developer
From: France
Registered: 22-Feb-2009
Posts: 2,024
Website

Re: code problem with listing contents of the cache partition

By default, in C:\Users\hebdemnobad\AppData\Local\Scol Voyager\, these two directories are located :

./cache
./logs

In ./cache, a sub-directory should be created named Prefix_##########
Usually, Prefix is Scol and ####### is a part of your Scol identifiant number (see your usmress.ini in your user partition)

Offline

#8 17-Dec-2014 23:02:44

Bob Le Gob
Scol language & Scol applications developer
Registered: 9-Apr-2009
Posts: 26

Re: code problem with listing contents of the cache partition

Well, I don't know if the 'public' limitation is excessive or not. I guess this was implemented mainly to protect the copyright of graphic data like textures and M3d files. On the other side, when you start using files' or directories' functions, you certainly are comfortable with Scol disk architecture, and so, you are able to find these files by yourself ... so ... protection or not can be discussed here ...

Offline

#9 19-Dec-2014 10:47:50

iri
Admin. / Scol language & Scol apps developer
From: France
Registered: 22-Feb-2009
Posts: 2,024
Website

Re: code problem with listing contents of the cache partition

Yes.
The content can be read by the system files explorer, this protection is very low.

A suggestion for this project : an option could offer the share to a public availability. The project would be copied in this "public" direcotry.

Offline

Board footer

Powered by FluxBB