| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 The Native Client Authors. All rights reserved. | 2 * Copyright 2015 The Native Client Authors. All rights reserved. |
| 3 * Use of this source code is governed by a BSD-style license that can be | 3 * Use of this source code is governed by a BSD-style license that can be |
| 4 * found in the LICENSE file. | 4 * found in the LICENSE file. |
| 5 */ | 5 */ |
| 6 | 6 |
| 7 /* globals NaClProcessManager */ |
| 8 |
| 9 'use strict'; |
| 10 |
| 7 NaClProcessManager.fsroot = '/devenv'; | 11 NaClProcessManager.fsroot = '/devenv'; |
| 8 | 12 |
| 9 // TODO(sbc): This should be handled by nacl_io or perhaps by NaClProcessManager | 13 // TODO(sbc): This should be handled by nacl_io or perhaps by NaClProcessManager |
| 10 function makeRootDir() { | 14 function makeRootDir() { |
| 11 return new Promise(function(accept, reject) { | 15 return new Promise(function(accept, reject) { |
| 12 function createDir(rootDirEntry, dirname) { | 16 function createDir(rootDirEntry, dirname) { |
| 13 rootDirEntry.getDirectory(dirname, {create: true}, | 17 rootDirEntry.getDirectory(dirname, {create: true}, |
| 14 function(dirEntry) { | 18 function(dirEntry) { |
| 15 accept(); | 19 accept(); |
| 16 }, | 20 }, |
| 17 function() { | 21 function() { |
| 18 console.log('rootDirEntry.getDirectory failed'); | 22 console.log('rootDirEntry.getDirectory failed'); |
| 19 reject(); | 23 reject(); |
| 20 } | 24 } |
| 21 ); | 25 ); |
| 22 } | 26 } |
| 23 | 27 |
| 24 window.requestFileSystem = window.requestFileSystem | 28 window.requestFileSystem = (window.requestFileSystem || |
| 25 || window.webkitRequestFileSystem; | 29 window.webkitRequestFileSystem); |
| 26 window.requestFileSystem( | 30 window.requestFileSystem( |
| 27 PERSISTENT, | 31 window.PERSISTENT, |
| 28 0, | 32 0, |
| 29 function(fs) { createDir(fs.root, NaClProcessManager.fsroot); }, | 33 function(fs) { createDir(fs.root, NaClProcessManager.fsroot); }, |
| 30 function() { | 34 function() { |
| 31 console.log('requestFileSystem failed!'); | 35 console.log('requestFileSystem failed!'); |
| 32 reject(); | 36 reject(); |
| 33 } | 37 } |
| 34 ); | 38 ); |
| 35 }); | 39 }); |
| 36 } | 40 } |
| OLD | NEW |