ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/DecentralizedMedia/Share.cpp
Revision: 514
Committed: 2005-06-20T00:19:47-07:00 (20 years ago) by douglas
File size: 1063 byte(s)
Log Message:
Added beginnings of Share stuff.

File Contents

# Content
1 // Share
2 //
3 // Douglas Thrift
4 //
5 // $Id$
6
7 #include "Share.hpp"
8
9 #include <menes-api/console.hpp>
10 #include <menes-api/realpath.hpp>
11
12 Share::Share(const _H<dbi::Connection>& connection, const ext::String& host, const ext::String& share) : connection(connection), host(host), share(share)
13 {
14 api::Path shares(api::RealPath(_B("Shares")));
15
16 if (!shares.Exists())
17 api::Posix::CheckError(::mkdir(shares.GetPath().NullTerminate(), 0755));
18
19 api::Path host_(shares.GetChild(host));
20
21 if (!host_.Exists())
22 api::Posix::CheckError(::mkdir(host_.GetPath().NullTerminate(), 0755));
23
24 path = host_.GetChild(share);
25
26 if (!path.Exists())
27 api::Posix::CheckError(::mkdir(path.GetPath().NullTerminate(), 0755));
28 }
29
30 void Share::Mount() const
31 {
32 api::Cout << "MOUNT: //" << host << "/" << share << " TO " << path.GetPath() << ios::NewLine;
33
34 // XXX: implement
35 }
36
37 void Share::Unmount() const
38 {
39 connection->Parse(_B("UPDATE files SET live = FALSE WHERE root = ?"))->Execute(path.GetPath());
40
41 api::Cout << "UNMOUNT: //" << path.GetPath() << ios::NewLine;
42
43 // XXX: implement
44 }

Properties

Name Value
svn:eol-style native
svn:keywords Id