Skip to content

Commit 96d11be

Browse files
committed
Fix wasm
1 parent 64d89f2 commit 96d11be

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

modules/yup_core/native/yup_Files_wasm.cpp

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,12 @@ bool File::isOnHardDisk() const
6868

6969
bool File::isOnRemovableDrive() const
7070
{
71-
jassertfalse; // xxx not yet implemented for wasm!
72-
return false;
71+
return false; // xxx not yet implemented for wasm!
7372
}
7473

7574
String File::getVersion() const
7675
{
77-
return {}; // xxx not yet implemented
76+
return {}; // xxx not yet implemented for wasm!
7877
}
7978

8079
//==============================================================================
@@ -191,18 +190,21 @@ static bool isFileExecutable (const String& filename)
191190
&& access (filename.toUTF8(), X_OK) == 0;
192191
}
193192

194-
bool Process::openDocument (const String& fileName, const String& parameters)
193+
bool Process::openDocument (const String& fileName, const String&)
195194
{
196-
auto cmdString = fileName.replace (" ", "\\ ", false);
197-
cmdString << " " << parameters;
195+
auto cmdString = "file://";
196+
cmdString << fileName.replace (" ", "\\ ", false);
198197

199198
MAIN_THREAD_EM_ASM ({
200-
var elem = window.document.createElement ('a');
201-
elem.href = UTF8ToString ($0);
202-
elem.target = "_blank";
203-
document.body.appendChild (elem);
204-
elem.click();
205-
document.body.removeChild (elem);
199+
if (window)
200+
{
201+
var elem = window.document.createElement ("a");
202+
elem.href = UTF8ToString ($0);
203+
elem.target = "_blank";
204+
document.body.appendChild (elem);
205+
elem.click();
206+
document.body.removeChild (elem);
207+
}
206208
}, cmdString.toRawUTF8());
207209

208210
return true;

0 commit comments

Comments
 (0)