#pragma once
// relative_path — the ONE absolute-path rejection test behind the
// relative-paths-only invariant, shared by every persisted path family
// (Sample.relativePath, OriginRecord.relativePath).
//
// Rejects rather than normalizes: the pure core has no knowledge of the project
// root, so any "normalization" would be a guess that could point at the wrong file.

#include <cctype>
#include <string>

namespace reasampler::util {

// True for POSIX root ("/x"), UNC ("\\host\share"), and any leading <alpha>: —
// including drive-RELATIVE forms ("C:foo.wav"), which resolve against the drive's
// current directory rather than the project root and so violate the invariant just
// as much as "C:\foo.wav" does.
inline bool isAbsolutePath(const std::string& p) {
    if (p.empty()) return false;
    if (p[0] == '/' || p[0] == '\\') return true;
    if (p.size() >= 2 && std::isalpha(static_cast<unsigned char>(p[0])) && p[1] == ':')
        return true;
    return false;
}

}  // namespace reasampler::util
