<commit_before>/*
 * Copyright 2016 - 2018 <EMAIL>
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */

#include <QDebug>
#include <QDir>
#include <QVector>

#include "oxfstreeview.hpp"

namespace nostalgia::studio {

using namespace ox;

OxFSFile::OxFSFile(PassThroughFS *fs, QString path, OxFSFile *parentItem) {
	m_path = path;
	m_parentItem = parentItem;

	// find children
	if (fs) {
		QVector<QString> ls;
		auto stat = fs->stat(static_cast<const char*>(m_path.toUtf8()));
		if (!stat.error) {
			if (stat.value.fileType == FileType_Directory) {
				fs->ls(m_path.toUtf8(), [&ls](const char *name, ox::InodeId_t) {
					ls.push_back(name);
					return OxError(0);
				});
				qSort(ls);
			}
			auto p = m_path;
			// make sure ends with path separator
			if (fs->stat(p.toUtf8().data()).value.fileType == FileType_Directory &&
				 p.size() && p.back() != QDir::separator()) {
				p += QDir::separator();
			}
			for (auto name : ls) {
				if (name != "." && name != "..") {
					const auto path = m_path.size() ? m_path + '/' + name : name;<commit_msg>[nostalgia/studio] Replace use of deprecated qSort with std::sort<commit_after>/*
 * Copyright 2016 - 2018 <EMAIL>
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */

#include <algorithm>

#include <QDebug>
#include <QDir>
#include <QVector>

#include "oxfstreeview.hpp"

namespace nostalgia::studio {

using namespace ox;

OxFSFile::OxFSFile(PassThroughFS *fs, QString path, OxFSFile *parentItem) {
	m_path = path;
	m_parentItem = parentItem;

	// find children
	if (fs) {
		QVector<QString> ls;
		auto stat = fs->stat(static_cast<const char*>(m_path.toUtf8()));
		if (!stat.error) {
			if (stat.value.fileType == FileType_Directory) {
				fs->ls(m_path.toUtf8(), [&ls](const char *name, ox::InodeId_t) {
					ls.push_back(name);
					return OxError(0);
				});
				std::sort(ls.begin(), ls.end());
			}
			auto p = m_path;
			// make sure ends with path separator
			if (fs->stat(p.toUtf8().data()).value.fileType == FileType_Directory &&
				 p.size() && p.back() != QDir::separator()) {
				p += QDir::separator();
			}
			for (auto name : ls) {
				if (name != "." && name != "..") {
					const auto path = m_path.size() ? m_path + '/' + name : name;
{'fraction_non_alphanumeric': 0.16561264822134386, 'fraction_numerical': 0.012648221343873518, 'mean_word_length': 3.386481802426343, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 22, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '357223', 'n_tokens_mistral': 1047, 'n_tokens_neox': 896, 'n_words': 243}