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 514 by douglas, 2005-06-20T00:19:47-07:00 vs.
Revision 534 by douglas, 2005-06-29T23:01:02-07:00

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines