forked from mail-ru-im/im-desktop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpost_install_action.cpp
48 lines (40 loc) · 1.08 KB
/
post_install_action.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include "stdafx.h"
#include "core.h"
#include "tools/system.h"
#include "tools/strings.h"
#include "post_install_action.h"
core::installer_services::post_install_action::post_install_action(std::wstring _file_name)
: act_file_name_(std::move(_file_name))
{
}
bool core::installer_services::post_install_action::load()
{
tools::binary_stream input;
if (!input.load_from_file(act_file_name_))
return false;
tools::binary_stream_reader reader(input);
while (!reader.eof())
{
auto line = reader.readline();
boost::trim(line);
if (line.empty())
continue;
try
{
tmp_dirs_.emplace(tools::from_utf8(line));
}
catch (...)
{
continue;
}
}
return true;
}
void core::installer_services::post_install_action::delete_tmp_resources()
{
if (!tmp_dirs_.empty())
for (const auto& dir : tmp_dirs_)
tools::system::delete_directory(dir);
if (tools::system::is_exist(act_file_name_))
tools::system::delete_file(act_file_name_);
}