(ems) simplify code
This commit is contained in:
parent
ff6861fc77
commit
5dcfe3bb24
|
@ -87,12 +87,12 @@ static void frontend_emscripten_get_env(int *argc, char *argv[],
|
||||||
snprintf(base_path, sizeof(base_path),
|
snprintf(base_path, sizeof(base_path),
|
||||||
"%s/retroarch", home);
|
"%s/retroarch", home);
|
||||||
snprintf(user_path, sizeof(user_path),
|
snprintf(user_path, sizeof(user_path),
|
||||||
"%s/userdata", home);
|
"%s/retroarch/userdata", home);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
snprintf(base_path, sizeof(base_path), "retroarch");
|
snprintf(base_path, sizeof(base_path), "retroarch");
|
||||||
snprintf(user_path, sizeof(user_path), "userdata");
|
snprintf(user_path, sizeof(user_path), "retroarch/userdata");
|
||||||
}
|
}
|
||||||
|
|
||||||
fill_pathname_join(g_defaults.dir.core, base_path,
|
fill_pathname_join(g_defaults.dir.core, base_path,
|
||||||
|
|
|
@ -92,52 +92,40 @@ function dropboxSync(dropboxClient, cb)
|
||||||
|
|
||||||
function setupFileSystem(backend)
|
function setupFileSystem(backend)
|
||||||
{
|
{
|
||||||
|
/* create a mountable filesystem that will server as a root
|
||||||
|
mountpoint for browserfs */
|
||||||
|
var mfs = new BrowserFS.FileSystem.MountableFileSystem();
|
||||||
|
|
||||||
|
/* create an XmlHttpRequest filesystem for the bundled data */
|
||||||
|
var xfs1 = new BrowserFS.FileSystem.XmlHttpRequest
|
||||||
|
(".index-xhr", "/web/assets/");
|
||||||
|
/* create an XmlHttpRequest filesystem for core assets */
|
||||||
|
var xfs2 = new BrowserFS.FileSystem.XmlHttpRequest
|
||||||
|
(".index-xhr", "/assets/cores/");
|
||||||
|
|
||||||
console.log("WEBPLAYER: Initializing Filesystem");
|
console.log("WEBPLAYER: Initializing Filesystem");
|
||||||
if(backend == "browser")
|
if(backend == "browser")
|
||||||
{
|
{
|
||||||
console.log("WEBPLAYER: Initializing LocalStorage");
|
console.log("WEBPLAYER: Initializing LocalStorage");
|
||||||
/* create a mountable filesystem that will server as a root
|
|
||||||
mountpoint for browserfs */
|
|
||||||
var mfs = new BrowserFS.FileSystem.MountableFileSystem();
|
|
||||||
/* create a local filesystem */
|
/* create a local filesystem */
|
||||||
var lsfs = new BrowserFS.FileSystem.LocalStorage();
|
var lsfs = new BrowserFS.FileSystem.LocalStorage();
|
||||||
/* create an XmlHttpRequest filesystem for assets */
|
|
||||||
var xfs1 = new BrowserFS.FileSystem.XmlHttpRequest
|
|
||||||
(".index-xhr", "/web/assets/");
|
|
||||||
var xfs2 = new BrowserFS.FileSystem.XmlHttpRequest
|
|
||||||
(".index-xhr", "/assets/cores/");
|
|
||||||
|
|
||||||
/* mount the local filesystem at the root of mfs*/
|
|
||||||
mfs.mount('/home/web_user/userdata', lsfs);
|
|
||||||
mfs.mount('/home/web_user/retroarch/bundle', xfs1);
|
|
||||||
mfs.mount('/home/web_user/downloads', xfs2);
|
|
||||||
|
|
||||||
BrowserFS.initialize(mfs);
|
/* mount the filesystems onto mfs */
|
||||||
var BFS = new BrowserFS.EmscriptenFS();
|
mfs.mount('/home/web_user/retroarch/userdata', lsfs);
|
||||||
FS.mount(BFS, {root: '/home'}, '/home');
|
}
|
||||||
console.log('WEBPLAYER: Filesystem initialized');
|
else
|
||||||
}
|
{
|
||||||
else
|
/* mount the filesystems onto mfs */
|
||||||
{
|
mfs.mount('/home/web_user/retroarch/userdata', afs);
|
||||||
/* create a mountable filesystem that will server as a root
|
}
|
||||||
mountpoint for browserfs */
|
|
||||||
var mfs = new BrowserFS.FileSystem.MountableFileSystem();
|
|
||||||
/* create an XmlHttpRequest filesystem for assets */
|
|
||||||
var xfs1 = new BrowserFS.FileSystem.XmlHttpRequest
|
|
||||||
(".index-xhr", "/web/assets/");
|
|
||||||
var xfs2 = new BrowserFS.FileSystem.XmlHttpRequest
|
|
||||||
(".index-xhr", "/assets/cores/");
|
|
||||||
|
|
||||||
/* mount the local filesystem at the root of mfs*/
|
|
||||||
mfs.mount('/home/web_user/userdata', afs);
|
|
||||||
mfs.mount('/home/web_user/retroarch/bundle', xfs1);
|
|
||||||
mfs.mount('/home/web_user/downloads', xfs2);
|
|
||||||
|
|
||||||
BrowserFS.initialize(mfs);
|
mfs.mount('/home/web_user/retroarch/bundle', xfs1);
|
||||||
var BFS = new BrowserFS.EmscriptenFS();
|
mfs.mount('/home/web_user/retroarch/downloads', xfs2);
|
||||||
FS.mount(BFS, {root: '/home'}, '/home');
|
BrowserFS.initialize(mfs);
|
||||||
console.log('WEBPLAYER: Filesystem initialized');
|
var BFS = new BrowserFS.EmscriptenFS();
|
||||||
}
|
FS.mount(BFS, {root: '/home'}, '/home');
|
||||||
|
console.log("WEBPLAYER: " + backened + " filesystem initialized");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue