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.
Pages: 1
Colleagues:
How would I use the core or os3d api to take:
[url]http://ifam.net/openspace/hybridui3/mainwindow/mainwindow.pak[/url] mainwindow/mainwindow.pak
And return:
mainwindow/mainwindow.pak
You can tell me where to look in the tools directories and I should be able to figure it out
Thx
Offline
there is tools for this in tools.pkg
getlastPathDir
Thx I'll get to work with that.
Offline
how to get the last two directories as a string from a url:
let "http://ifam.net/openspace/spacemanshooter17/dan_no_mohawk/spacemanshooter1.pak" -> urlsrc in
let getlastPathDir urlsrc -> destpathfile in
let getFilePathWithoutExt destpathfile -> download_directory in
let strcatn download_directory::"/"::destpathfile::nil-> destpath in
will return:
spacemanshooter/spacemanshooter1.pak
which is ok, (the file saves to cache and loads in player) although how would I get a return value of "dan_no_mohawk" from the full url?
Offline
let "http://ifam.net/openspace/spacemanshooter17/dan_no_mohawk/spacemanshooter1.pak" -> urlsrc in
let getlastPathDir urlsrc -> destpathfile in
let getlastPathDir destpathfile -> download_directory in
let strcatn download_directory::"/"::destpathfile::nil-> destpath in
No ?
Why you write :
let getFilePathWithoutExt destpathfile -> download_directory in
Offline
Its my ignorant attempts to get second to last directory..
Offline
Offline
let strToListSep path "/" -< l in
let nth_list l (sizelist l) - 2 -< dir in
I was thinking in my uneducated mind something involving slicing up a string into a list thx.
Offline
thx arkeon
for the scol overmind
how to use core api/os3d string tools to get the name of a file, preceded by a forward slash, preceded by the next higher directory
full url: "http://ifam.net/openspace/spacemanshoot … ooter1.pak"
string we want to use as path to save file in cache: "dan_no_mohawk/spacemanshooter1.pak"
getUrlContentLenght "http://ifam.net/openspace/spacemanshooter17/dan_no_mohawk/spacemanshooter1.pak" @cbGetContentLength;
let "http://ifam.net/openspace/spacemanshooter17/dan_no_mohawk/spacemanshooter1.pak" -> urlsrc in
//get the name of the file, this is the 'lastpath'.
let getlastPathDir urlsrc -> destpathfile in
//split string into list of strings s r1, each of which is before, between, or after a "/"
let strToListSep urlsrc "/" -> urlist in
//get the second to last string, which is the folder in which the file is found
let nth_list urlist (sizelist urlist) - 2 ->secontolastdir in
//put file's folder together with / with file name
let strcatn secontolastdir::"/"::destpathfile::nil-> destpath in
this code produces the string: "dan_no_mohawk/spacemanshooter1.pak", which is the same string as lastpath, along with the name of the directory holding it.
Offline
Pages: 1