(ems) simplify code

This commit is contained in:
radius 2016-09-09 00:25:27 -05:00
parent ff6861fc77
commit 5dcfe3bb24
2 changed files with 28 additions and 40 deletions

View File

@ -87,12 +87,12 @@ static void frontend_emscripten_get_env(int *argc, char *argv[],
snprintf(base_path, sizeof(base_path),
"%s/retroarch", home);
snprintf(user_path, sizeof(user_path),
"%s/userdata", home);
"%s/retroarch/userdata", home);
}
else
{
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,

View File

@ -92,52 +92,40 @@ function dropboxSync(dropboxClient, cb)
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");
if(backend == "browser")
{
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 */
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);
var BFS = new BrowserFS.EmscriptenFS();
FS.mount(BFS, {root: '/home'}, '/home');
console.log('WEBPLAYER: Filesystem initialized');
}
else
{
/* 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);
/* mount the filesystems onto mfs */
mfs.mount('/home/web_user/retroarch/userdata', lsfs);
}
else
{
/* mount the filesystems onto mfs */
mfs.mount('/home/web_user/retroarch/userdata', afs);
}
BrowserFS.initialize(mfs);
var BFS = new BrowserFS.EmscriptenFS();
FS.mount(BFS, {root: '/home'}, '/home');
console.log('WEBPLAYER: Filesystem initialized');
}
mfs.mount('/home/web_user/retroarch/bundle', xfs1);
mfs.mount('/home/web_user/retroarch/downloads', xfs2);
BrowserFS.initialize(mfs);
var BFS = new BrowserFS.EmscriptenFS();
FS.mount(BFS, {root: '/home'}, '/home');
console.log("WEBPLAYER: " + backened + " filesystem initialized");
}
/**