Add ProgramData to the env var whitelist for running scripts
[cygwin-setup.git] / SourceSetting.cc
blob1e8700bb235b34877f34379f51e9ebd84071ee5e
1 /*
2 * Copyright (c) 2003, Robert Collins <rbtcollins@hotmail.com>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * A copy of the GNU General Public License can be found at
10 * http://www.gnu.org/
12 * Written by Robert Collins.
16 #include "SourceSetting.h"
17 #include "UserSettings.h"
18 #include "io_stream.h"
19 #include "state.h"
20 #include "resource.h"
21 #include "String++.h"
23 SourceSetting::SourceSetting ()
25 const char *fg_ret;
26 if ((fg_ret = UserSettings::instance().get ("last-action")))
27 source = sourceFromString(fg_ret);
30 SourceSetting::~SourceSetting ()
32 switch (source)
34 case IDC_SOURCE_DOWNLOAD:
35 UserSettings::instance().set ("last-action", "Download");
36 break;
37 case IDC_SOURCE_NETINST:
38 UserSettings::instance().set ("last-action", "Download,Install");
39 break;
40 case IDC_SOURCE_LOCALDIR:
41 UserSettings::instance().set ("last-action", "Install");
42 break;
43 default:
44 break;
48 int
49 SourceSetting::sourceFromString(const std::string& aSource)
51 if (!casecompare(aSource, "Download"))
52 return IDC_SOURCE_DOWNLOAD;
53 if (!casecompare(aSource, "Download,Install"))
54 return IDC_SOURCE_NETINST;
55 if (!casecompare(aSource, "Install"))
56 return IDC_SOURCE_LOCALDIR;
58 /* A sanish default */
59 return IDC_SOURCE_NETINST;