8 |
|
|
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::Address& host, const cse::String& share) : connection(connection), host(host), share(share) |
12 |
|
{ |
13 |
|
api::Path shares(_B("Shares")); |
14 |
|
|
15 |
|
if (!shares.Exists()) |
16 |
|
shares.CreateDirectory(); |
17 |
|
|
18 |
< |
api::Path host_(shares.GetRealPath().GetChild(host)); |
18 |
> |
cse::String address, port; |
19 |
> |
|
20 |
> |
host.ToString(address, port); |
21 |
> |
|
22 |
> |
api::Path host_(shares.GetRealPath().GetChild(address)); |
23 |
|
|
24 |
|
if (!host_.Exists()) |
25 |
|
host_.CreateDirectory(); |
30 |
|
path.CreateDirectory(); |
31 |
|
} |
32 |
|
|
33 |
< |
void Share::Mount() const |
30 |
< |
{ |
31 |
< |
api::Cout << "MOUNT: //" << host << "/" << share << " TO " << path.GetPath() << ios::NewLine; |
32 |
< |
|
33 |
< |
// XXX: implement |
34 |
< |
} |
35 |
< |
|
36 |
< |
void Share::Unmount() const |
33 |
> |
Share::~Share() |
34 |
|
{ |
35 |
|
connection->Parse(_B("UPDATE files SET live = FALSE WHERE root = ?"))->Execute(path.GetPath()); |
39 |
– |
|
40 |
– |
api::Cout << "UNMOUNT: //" << path.GetPath() << ios::NewLine; |
41 |
– |
|
42 |
– |
// XXX: implement |
36 |
|
} |