Skip to content

Commit

Permalink
Fixup utilitary function (last_write_time)
Browse files Browse the repository at this point in the history
  • Loading branch information
cbentejac committed Jan 8, 2024
1 parent 351ceca commit 9b2a916
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/aliceVision/utils/filesIO.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,15 @@

#pragma once

#include <codecvt>
#include <filesystem>
#include <functional>
#include <iostream>
#include <random>
#include <string>
#include <sys/stat.h>
#include <vector>

#ifdef _WIN32
#include <windows.h>
#else
#include <sys/stat.h>
#endif

namespace aliceVision {
namespace utils {
Expand Down Expand Up @@ -102,7 +99,9 @@ inline std::time_t getLastWriteTime(const std::string& path)
{
#ifdef _WIN32
struct __stat64 st;
auto r = _wstat64(std::filesystem::path(Strutil::utf8_to_utf16wstring(path)).c_str(), &st);
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>, wchar_t> conv;
std::wstring str = conv.from_bytes(path.data(), path.data() + path.size());
auto r = _wstat64(std::filesystem::path(str).c_str(), &st);
#else
struct stat st;
auto r = stat(std::filesystem::path(path).c_str(), &st);
Expand Down

0 comments on commit 9b2a916

Please sign in to comment.