Browse Source

Merge branch 'xml_prologue' of https://gitlab.com/doe300/jucipp

merge-requests/413/head
eidheim 3 years ago
parent
commit
45c9f5b96d
  1. 9
      src/source.cpp

9
src/source.cpp

@ -14,6 +14,7 @@
#include <boost/spirit/home/qi/char.hpp>
#include <boost/spirit/home/qi/operator.hpp>
#include <boost/spirit/home/qi/string.hpp>
#include <fstream>
#include <iostream>
#include <limits>
#include <map>
@ -88,6 +89,14 @@ Glib::RefPtr<Gsv::Language> Source::guess_language(const boost::filesystem::path
}
}
}
else {
std::ifstream input(file_path.string(), std::ios::binary);
std::string tag(5, '\0');
if(input && input.read(&tag[0], static_cast<std::streamsize>(tag.size()))) {
if(tag == "<?xml")
language = language_manager->get_language("xml");
}
}
}
else if(language->get_id() == "cuda") {
if(file_path.extension() == ".cuh")

Loading…
Cancel
Save