Skip to content

Commit

Permalink
Merge pull request #9 from julianoes/pr-c-dir
Browse files Browse the repository at this point in the history
camera-manager: don't use std::filesystem
  • Loading branch information
julianoes authored Feb 27, 2024
2 parents cfa2da5 + b3158a5 commit 13ba2b0
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions camera-manager/camera_manager.cpp
Original file line number Diff line number Diff line change
@@ -1,14 +1,27 @@
#include <iostream>
#include <chrono>
#include <thread>
#include <filesystem>
#include <mavsdk/mavsdk.h>
#include <mavsdk/plugins/camera_server/camera_server.h>
#include <mavsdk/plugins/ftp_server/ftp_server.h>
#include <mavsdk/plugins/param_server/param_server.h>
#include "siyi_protocol.hpp"
#include "siyi_camera.hpp"

#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>

bool is_dir(const std::string& path)
{
struct stat statbuf;
if (stat(path.c_str(), &statbuf) != 0) {
// Error getting information about the path
return false;
}
return (S_ISDIR(statbuf.st_mode) != 0);
}

int main(int argc, char* argv[])
{
if (argc != 4) {
Expand Down Expand Up @@ -58,7 +71,7 @@ int main(int argc, char* argv[])

// If running locally when built first, otherwise use system-wise:
std::string path = "./camera-manager/mavlink_ftp_root";
if (!std::filesystem::exists(path)) {
if (!is_dir(path)) {
path = "/usr/share/mavlink_ftp_root";
}

Expand Down

0 comments on commit 13ba2b0

Please sign in to comment.