ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/DecentralizedMedia/Share.cpp
Revision: 516
Committed: 2005-06-20T20:34:13-07:00 (20 years ago) by douglas
File size: 1060 byte(s)
Log Message:
Refactored includes to be the way they should, added a precompiled header for msp files to use.

File Contents

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

Properties

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