|
|
|
@ -5,7 +5,7 @@ |
|
|
|
const size_t buffer_size=131072; |
|
|
|
const size_t buffer_size=131072; |
|
|
|
|
|
|
|
|
|
|
|
//Only use on small files
|
|
|
|
//Only use on small files
|
|
|
|
std::string juci::filesystem::open(const std::string &path) { |
|
|
|
std::string juci::filesystem::read(const std::string &path) { |
|
|
|
std::stringstream ss; |
|
|
|
std::stringstream ss; |
|
|
|
std::ifstream input(path); |
|
|
|
std::ifstream input(path); |
|
|
|
if(input) { |
|
|
|
if(input) { |
|
|
|
@ -15,7 +15,7 @@ std::string juci::filesystem::open(const std::string &path) { |
|
|
|
return ss.str(); |
|
|
|
return ss.str(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bool juci::filesystem::open(const std::string &path, Glib::RefPtr<Gtk::TextBuffer> text_buffer) { |
|
|
|
bool juci::filesystem::read(const std::string &path, Glib::RefPtr<Gtk::TextBuffer> text_buffer) { |
|
|
|
std::ifstream input(path); |
|
|
|
std::ifstream input(path); |
|
|
|
if(input) { |
|
|
|
if(input) { |
|
|
|
std::vector<char> buffer(buffer_size); |
|
|
|
std::vector<char> buffer(buffer_size); |
|
|
|
@ -29,7 +29,7 @@ bool juci::filesystem::open(const std::string &path, Glib::RefPtr<Gtk::TextBuffe |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//Only use on small files
|
|
|
|
//Only use on small files
|
|
|
|
std::vector<std::string> juci::filesystem::lines(const std::string &path) { |
|
|
|
std::vector<std::string> juci::filesystem::read_lines(const std::string &path) { |
|
|
|
std::vector<std::string> res; |
|
|
|
std::vector<std::string> res; |
|
|
|
std::ifstream input(path); |
|
|
|
std::ifstream input(path); |
|
|
|
if (input) { |
|
|
|
if (input) { |
|
|
|
@ -40,7 +40,7 @@ std::vector<std::string> juci::filesystem::lines(const std::string &path) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//Only use on small files
|
|
|
|
//Only use on small files
|
|
|
|
bool juci::filesystem::save(const std::string &path, const std::string &new_content) { |
|
|
|
bool juci::filesystem::write(const std::string &path, const std::string &new_content) { |
|
|
|
std::ofstream output(path); |
|
|
|
std::ofstream output(path); |
|
|
|
if(output) |
|
|
|
if(output) |
|
|
|
output << new_content; |
|
|
|
output << new_content; |
|
|
|
@ -50,7 +50,7 @@ bool juci::filesystem::save(const std::string &path, const std::string &new_cont |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bool juci::filesystem::save(const std::string &path, Glib::RefPtr<Gtk::TextBuffer> buffer) { |
|
|
|
bool juci::filesystem::write(const std::string &path, Glib::RefPtr<Gtk::TextBuffer> buffer) { |
|
|
|
std::ofstream output(path); |
|
|
|
std::ofstream output(path); |
|
|
|
if(output) { |
|
|
|
if(output) { |
|
|
|
auto start_iter=buffer->begin(); |
|
|
|
auto start_iter=buffer->begin(); |
|
|
|
|