android: Don't try to read discovery.xml, it's not needed on mobile.

With this, the actual loolwsd startup does not crash any more, so let's
enable it :-)  Of course it still does not work yet.

Change-Id: I5a1ee7adac64c57f1aa5b597c3dbdc0089a1ac11
This commit is contained in:
Jan Holesovsky 2019-02-13 17:34:59 +01:00
parent 7b48434d0d
commit e3b17cdc3c
3 changed files with 10 additions and 5 deletions

View file

@ -25,7 +25,7 @@ public class MainActivity extends AppCompatActivity {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//createLOOLWSD();
createLOOLWSD();
final WebView browser = findViewById(R.id.browser);
browser.setWebViewClient(new WebViewClient());

View file

@ -2713,12 +2713,11 @@ private:
/// Process the discovery.xml file and return as string.
static std::string getDiscoveryXML()
{
#if defined __linux && MOBILEAPP
// discovery.xml is in the top directory
std::string discoveryPath = Path(Application::instance().commandPath()).parent().parent().toString() + "discovery.xml";
#if MOBILEAPP
// not needed for mobile
return std::string();
#else
std::string discoveryPath = Path(Application::instance().commandPath()).parent().toString() + "discovery.xml";
#endif
if (!File(discoveryPath).exists())
{
// http://server/hosting/discovery.xml
@ -2767,6 +2766,7 @@ private:
DOMWriter writer;
writer.writeNode(ostrXML, docXML);
return ostrXML.str();
#endif
}
/// Create the /hosting/capabilities JSON and return as string.

View file

@ -95,9 +95,14 @@ public:
/// Return true iff extension is marked as view action in discovery.xml.
static bool IsViewFileExtension(const std::string& extension)
{
#if MOBILEAPP
(void) extension;
return false; // mark everything editable on mobile
#else
std::string lowerCaseExtension = extension;
std::transform(lowerCaseExtension.begin(), lowerCaseExtension.end(), lowerCaseExtension.begin(), ::tolower);
return EditFileExtensions.find(lowerCaseExtension) == EditFileExtensions.end();
#endif
}
/// Returns the value of the specified application configuration,