Sha256: a27a38222a833a8e560d24062c3cbe0ae47da1a9223a6fe6e42b56e79e055c10

Contents?: true

Size: 822 Bytes

Versions: 30

Compression:

Stored size: 822 Bytes

Contents

#include <Gosu/Directories.hpp>
#include <Gosu/WinUtility.hpp>
#include <cwchar>
#include <stdexcept>
#include <shlobj.h>

namespace
{
	std::wstring specialFolderPath(int csidl)
	{
		WCHAR buf[MAX_PATH + 2];
		if (!SHGetSpecialFolderPath(0, buf, csidl, TRUE))
			throw std::runtime_error("Error getting special folder path");
		std::size_t len = std::wcslen(buf);
		if (buf[len - 1] != '\\')
		{
			buf[len] = L'\\';
			buf[len + 1] = L'\0';
		}
		return buf;
	}
}

std::wstring Gosu::resourcePrefix()
{
	return Win::appDirectory();
}

std::wstring Gosu::sharedResourcePrefix()
{
	return Win::appDirectory();
}

std::wstring Gosu::userSettingsPrefix()
{
	return specialFolderPath(CSIDL_APPDATA);
}

std::wstring Gosu::userDocsPrefix()
{
	return specialFolderPath(CSIDL_PERSONAL);
}

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
gosu-0.7.15 GosuImpl/DirectoriesWin.cpp
gosu-0.7.14 GosuImpl/DirectoriesWin.cpp
gosu-0.7.10.1 GosuImpl/DirectoriesWin.cpp
gosu-0.7.10.3 GosuImpl/DirectoriesWin.cpp
gosu-0.7.10.2 GosuImpl/DirectoriesWin.cpp
gosu-0.7.11 GosuImpl/DirectoriesWin.cpp
gosu-0.7.12 GosuImpl/DirectoriesWin.cpp
gosu-0.7.13.2 GosuImpl/DirectoriesWin.cpp
gosu-0.7.13.3 GosuImpl/DirectoriesWin.cpp
gosu-0.7.13 GosuImpl/DirectoriesWin.cpp