<commit_before>#include "asset.hpp"
#include "util/common.hpp"
#include "osdialog.h"

#if ARCH_MAC
	#include <CoreFoundation/CoreFoundation.h>
	#include <pwd.h>
#endif

#if ARCH_WIN
	#include <Windows.h>
	#include <Shlobj.h>
	#include <Shlwapi.h>
#endif

#if ARCH_LIN
	#include <unistd.h>
	#include <sys/types.h>
	#include <pwd.h>
#endif


namespace rack {


static std::string globalDir;
static std::string localDir;


void assetInit(bool devMode) {
	if (devMode) {
		// Use current working directory if running in development mode
		globalDir = ".";
		localDir = ".";
		return;
	}

#if ARCH_MAC
	CFBundleRef bundle = CFBundleGetMainBundle();
	assert(bundle);
	CFURLRef resourcesUrl = CFBundleCopyResourcesDirectoryURL(bundle);
	char buf[PATH_MAX];
	Boolean success = CFURLGetFileSystemRepresentation(resourcesUrl, TRUE, (UInt8*) buf, sizeof(buf));
	assert(success);
	CFRelease(resourcesUrl);
	globalDir = buf;

	// Get home directory
	struct passwd *pw = getpwuid(getuid());
	assert(pw);
	localDir = pw->pw_dir;
	localDir += "/Documents/Rack";
#endif
#if ARCH_WIN
	char buf[MAX_PATH];
	DWORD length = GetModuleFileName(NULL, buf, sizeof(buf));
	assert(length > 0);
	PathRemoveFileSpec(buf);
	globalDir = buf;

	// Get "My Documents" folder
	char buf[MAX_PATH];
	HRESULT result = SHGetFolderPath(NULL, CSIDL_MYDOCUMENTS, NULL, SHGFP_TYPE_CURRENT, buf);
	assert(result == S_OK);
	localDir = buf;
	localDir += "/Rack";
#endif
#if ARCH_LIN
	// TODO For now, users should launch Rack from their terminal in the global directory
	globalDir = ".";

	// Get home directory
	const char *home = getenv("HOME");
	if (!home) {
		struct passwd *pw = getpwuid(getuid());
		assert(pw);
		home = pw->pw_dir;
	}
	localDir = home;
	localDir += "/.Rack";
#endif
}


std::string assetGlobal(std::string filename) {
	return globalDir + "/" + filename;
}


std::string assetLocal(std::string filename) {
	return localDir + "/" + filename;
}


std::string assetPlugin(Plugin *plugin, std::string filename) {
	assert(plugin);
	return plugin->path + "/" + filename;
}


} // namespace rack
<commit_msg>Fix asset.cpp variable names<commit_after>#include "asset.hpp"
#include "util/common.hpp"
#include "osdialog.h"

#if ARCH_MAC
	#include <CoreFoundation/CoreFoundation.h>
	#include <pwd.h>
#endif

#if ARCH_WIN
	#include <Windows.h>
	#include <Shlobj.h>
	#include <Shlwapi.h>
#endif

#if ARCH_LIN
	#include <unistd.h>
	#include <sys/types.h>
	#include <pwd.h>
#endif


namespace rack {


static std::string globalDir;
static std::string localDir;


void assetInit(bool devMode) {
	if (devMode) {
		// Use current working directory if running in development mode
		globalDir = ".";
		localDir = ".";
		return;
	}

#if ARCH_MAC
	CFBundleRef bundle = CFBundleGetMainBundle();
	assert(bundle);
	CFURLRef resourcesUrl = CFBundleCopyResourcesDirectoryURL(bundle);
	char resourcesBuf[PATH_MAX];
	Boolean success = CFURLGetFileSystemRepresentation(resourcesUrl, TRUE, (UInt8*) resourcesBuf, sizeof(resourcesBuf));
	assert(success);
	CFRelease(resourcesUrl);
	globalDir = resourcesBuf;

	// Get home directory
	struct passwd *pw = getpwuid(getuid());
	assert(pw);
	localDir = pw->pw_dir;
	localDir += "/Documents/Rack";
#endif
#if ARCH_WIN
	char moduleBuf[MAX_PATH];
	DWORD length = GetModuleFileName(NULL, moduleBuf, sizeof(moduleBuf));
	assert(length > 0);
	PathRemoveFileSpec(moduleBuf);
	globalDir = moduleBuf;

	// Get "My Documents" folder
	char documentsBuf[MAX_PATH];
	HRESULT result = SHGetFolderPath(NULL, CSIDL_MYDOCUMENTS, NULL, SHGFP_TYPE_CURRENT, documentsBuf);
	assert(result == S_OK);
	localDir = documentsBuf;
	localDir += "/Rack";
#endif
#if ARCH_LIN
	// TODO For now, users should launch Rack from their terminal in the global directory
	globalDir = ".";

	// Get home directory
	const char *homeBuf = getenv("HOME");
	if (!homeBuf) {
		struct passwd *pw = getpwuid(getuid());
		assert(pw);
		homeBuf = pw->pw_dir;
	}
	localDir = homeBuf;
	localDir += "/.Rack";
#endif
}


std::string assetGlobal(std::string filename) {
	return globalDir + "/" + filename;
}


std::string assetLocal(std::string filename) {
	return localDir + "/" + filename;
}


std::string assetPlugin(Plugin *plugin, std::string filename) {
	assert(plugin);
	return plugin->path + "/" + filename;
}


} // namespace rack

{'fraction_non_alphanumeric': 0.13674614305750352, 'fraction_numerical': 0.0009350163627863488, 'mean_word_length': 4.885832187070151, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 27, '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': '1401231', 'n_tokens_mistral': 1536, 'n_tokens_neox': 1491, 'n_words': 375}