Example #1
0
void
CopyFile(const char* dst, FileDescriptor src_fd, mode_t dst_mode,
         size_t allowed_links, bool share)
{
    FileDescriptor::WriteContent(EnsureUniqueFile(dst, dst_mode, allowed_links,
                                 share).get(), Nonnull(src_fd));
}
Example #2
0
bool
FetchEnvironmentVariable(string& res, const char* var)
{
	if(const auto val = std::getenv(Nonnull(var)))
	{
		res = val;
		return true;
	}
	return {};
}
Example #3
0
DSWindow::DSWindow(NativeWindowHandle h_wnd, DSScreen& s_up, DSScreen& s_dn,
	GUIHost& h)
	: Window(h_wnd, h), scr_up(s_up), scr_dn(s_dn)
{
#	if YCL_Win32
	yunseq(
	MessageMap[WM_DESTROY] += []{
		YSLib::PostQuitMessage(0);
		// NOTE: Try to make sure all shells are released before destructing the
		//	instance of %DSApplication.
	},
	MessageMap[WM_PAINT] += [this]{
		GSurface<WindowRegionDeviceContext> sf(Nonnull(GetNativeHandle()));
		const auto& r(sf.GetInvalidatedArea());

		UpdateScreen(sf, scr_up, r);
		UpdateScreen(sf, scr_dn, r);
	}
	);
	Show();
#	endif
}
Example #4
0
void
CopyFile(UniqueFile p_dst, FileDescriptor src_fd)
{
    FileDescriptor::WriteContent(Nonnull(p_dst.get()), Nonnull(src_fd));
}