ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/DecentralizedMedia/Share.cpp
(Generate patch)

Comparing DecentralizedMedia/Share.cpp (file contents):
Revision 516 by douglas, 2005-06-20T20:34:13-07:00 vs.
Revision 542 by douglas, 2005-07-03T00:31:07-07:00

# Line 6 | Line 6
6  
7   #include <menes/standard.hh>
8  
9 #include <menes-api/realpath.hpp>
10
9   #include "Share.hpp"
10  
11 < Share::Share(const _H<dbi::Connection>& connection, const ext::String& host, const ext::String& share) : connection(connection), host(host), share(share)
11 > Share::Share(const _R<dbi::Connection>& connection, const api::InternetAddress& host, const cse::String& share) : connection(connection), host(host), share(share)
12   {
13 <        api::Path shares(api::RealPath(_B("Shares")));
13 >        cse::String address, port;
14  
15 <        if (!shares.Exists())
18 <                api::Posix::CheckError(::mkdir(shares.GetPath().NullTerminate(), 0755));
15 >        host.ToString(address, port);
16  
17 <        api::Path host_(shares.GetChild(host));
17 >        api::Path host_(shares.GetChild(address));
18  
19          if (!host_.Exists())
20 <                api::Posix::CheckError(::mkdir(host_.GetPath().NullTerminate(), 0755));
20 >                host_.CreateDirectory();
21  
22          path = host_.GetChild(share);
23  
24          if (!path.Exists())
25 <                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
25 >                path.CreateDirectory();
26   }
27  
28 < void Share::Unmount() const
28 > Share::~Share()
29   {
30          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
31   }
32 +
33 + api::Path Share::shares(_B("Shares"));

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines