linux-v4l2: scandir with alphasort on non-Linux

Sort video device entries with `alphasort` on non-Linux platforms,
as opposed to `versionsort` on Linux.
(`versionsort` is a GNU extension, unavailable on e.g. FreeBSD.)

UI: Fix call to `to_string` on FreeBSD
This commit is contained in:
obiwac 2022-02-26 13:50:21 +01:00 committed by Jim
parent c50c625555
commit 93c2e681ca
2 changed files with 9 additions and 2 deletions

View File

@ -136,7 +136,7 @@ const char *RunOnce::thr_name = "OBS runonce";
void PIDFileCheck(bool &already_running)
{
std::string tmpfile_name =
"/tmp/obs-studio.lock." + to_string(geteuid());
"/tmp/obs-studio.lock." + std::to_string(geteuid());
int fd = open(tmpfile_name.c_str(), O_RDWR | O_CREAT | O_EXLOCK, 0600);
if (fd == -1) {
already_running = true;

View File

@ -185,7 +185,14 @@ static bool virtualcam_start(void *data)
return false;
}
n = scandir("/dev", &list, scanfilter, versionsort);
n = scandir("/dev", &list, scanfilter,
#if defined(__linux__)
versionsort
#else
alphasort
#endif
);
if (n == -1)
return false;