Skip to content

Commit

Permalink
frame: migrate to std::filesystem (#180)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattkae authored Apr 29, 2024
2 parents c40835f + 1ae393f commit b212925
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 13 deletions.
2 changes: 0 additions & 2 deletions snap/snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,10 @@ parts:
- pkg-config
- libmiral-dev
- libwayland-dev
- libboost-filesystem-dev
- libboost-iostreams-dev
- libapparmor-dev
- libfreetype6-dev
stage-packages:
- libboost-filesystem1.74.0
- libboost-iostreams1.74.0
# Stage libmiral<n> indirectly as we cannot (since core22) do `try:/else:`
- libmiral-dev
Expand Down
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ add_executable(frame
)

# Check for boost
find_package(Boost 1.48.0 COMPONENTS filesystem iostreams REQUIRED)
find_package(Boost 1.48.0 COMPONENTS iostreams REQUIRED)

target_compile_definitions(frame PRIVATE MIR_LOG_COMPONENT="frame")

Expand Down
7 changes: 4 additions & 3 deletions src/background_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,15 @@
#include <chrono>
#include <cstring>
#include <codecvt>
#include <filesystem>
#include <fstream>
#include <sstream>

#include <boost/throw_exception.hpp>
#include <boost/filesystem.hpp>

#include <mir/fatal.h>

namespace fs = boost::filesystem;
namespace fs = std::filesystem;
using Path = fs::path;

namespace
Expand Down Expand Up @@ -62,7 +63,7 @@ auto TextRenderer::DiagnosticText::from(Path const& path) -> DiagnosticText
static const int max_line_length = 250;


fs::ifstream in{path};
std::ifstream in{path};
std::vector<std::string> lines;
std::string line;
for (int line_count = 0; getline(in, line); ++line_count)
Expand Down
7 changes: 3 additions & 4 deletions src/background_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#ifndef FRAME_BACKGROUND_CLIENT
#define FRAME_BACKGROUND_CLIENT

#include <filesystem>
#include <memory>
#include <mutex>
#include <optional>
Expand All @@ -25,8 +26,6 @@
#include <miral/application.h>
#include <mir/geometry/rectangles.h>

#include <boost/filesystem.hpp>

#include <ft2build.h>
#include FT_FREETYPE_H

Expand Down Expand Up @@ -85,7 +84,7 @@ class BackgroundClient

uint diagnostic_delay = 0;

std::optional<boost::filesystem::path> diagnostic_path;
std::optional<std::filesystem::path> diagnostic_path;

struct Self;
std::weak_ptr<Self> self;
Expand All @@ -96,7 +95,7 @@ class BackgroundClient
class TextRenderer
{
public:
using Path = boost::filesystem::path;
using Path = std::filesystem::path;

TextRenderer(Path font_path);
~TextRenderer();
Expand Down
5 changes: 2 additions & 3 deletions src/egfullscreenclient.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,9 @@

#include <wayland-client.h>

#include <boost/filesystem.hpp>

#include <sys/inotify.h>

#include <filesystem>
#include <functional>
#include <map>
#include <memory>
Expand All @@ -47,7 +46,7 @@ namespace egmde
class FullscreenClient
{
public:
using Path = boost::filesystem::path;
using Path = std::filesystem::path;

explicit FullscreenClient(
wl_display* display,
Expand Down

0 comments on commit b212925

Please sign in to comment.