Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nuke IRC, and some other unnecessary code #153

Merged
merged 3 commits into from Jan 26, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 0 additions & 1 deletion src.cmake
Expand Up @@ -320,7 +320,6 @@ set(CLIENTBASELIST
${ENGINE_DIR}/client/cl_cin.cpp
${ENGINE_DIR}/client/cl_console.cpp
${ENGINE_DIR}/client/cl_input.cpp
${ENGINE_DIR}/client/cl_irc.cpp
${ENGINE_DIR}/client/cl_main.cpp
${ENGINE_DIR}/client/cl_parse.cpp
${ENGINE_DIR}/client/cl_scrn.cpp
Expand Down
3 changes: 0 additions & 3 deletions src/common/Defs.h
Expand Up @@ -53,9 +53,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define MASTER4_SERVER_NAME ""
#define MASTER5_SERVER_NAME ""

#define IRC_SERVER "irc.freenode.org"
#define IRC_CHANNEL "unv-lobby"

#define WWW_BASEURL "dl.unvanquished.net/pkg"

#define AUTOEXEC_NAME "autoexec.cfg"
Expand Down
57 changes: 0 additions & 57 deletions src/common/FileSystem.cpp
Expand Up @@ -2071,63 +2071,6 @@ std::string DefaultHomePath()
#endif
}

void MigrateHomePath()
{
#if defined(__linux__)
const char* home = getenv("HOME");
if (!home) {
// in this case DefaultHomePath() will return "",
// hence homePath will be neither the legacy one
// neither the xdg one, hence there is nothing we can do.
return;
}

const char* _xdgDataHome = getenv("XDG_DATA_HOME");
std::string xdgDataHome = _xdgDataHome == nullptr ? Path::Build(Path::Build(std::string(home), ".local") ,"share") : std::string(_xdgDataHome);
std::string xdgHomePath = DefaultHomePath();
std::string legacyHomePath = Path::Build(std::string(home), "." PRODUCT_NAME_LOWER);
struct stat stl, stx;

if (lstat(legacyHomePath.c_str(), &stl) == 0) {
if (S_ISDIR(stl.st_mode) || S_ISLNK(stl.st_mode)) {
if (stat(xdgHomePath.c_str(), &stx) != 0) {
std::error_code err;

RawPath::CreatePathTo(xdgDataHome, err);

if (err) {
Sys::Error("Could not create XDG data directory %s: %s", xdgDataHome, err.message());
}

if (S_ISLNK(stl.st_mode)) {
int ret;
int fd = open(xdgDataHome.c_str(), O_DIRECTORY);

if (fd == -1) {
Sys::Error("Could not open XDG data directory %s: %s", xdgDataHome, strerror(errno));
}

fsLogs.Warn("Creating legacy home path symlink %s to XDG home path %s", legacyHomePath, xdgHomePath);
ret = symlinkat(legacyHomePath.c_str(), fd, xdgHomePath.c_str());

if (ret == -1) {
Sys::Error("Could not create symlink %s: %s", xdgHomePath, strerror(errno));
}
} else {
fsLogs.Warn("Renaming legacy home path %s to XDG home path %s", legacyHomePath, xdgHomePath);
RawPath::MoveFile(xdgHomePath, legacyHomePath, err);
}

if (err) {
Sys::Error("Could not rename legacy home path to %s: %s", xdgHomePath, err.message());
}
} else {
fsLogs.Warn("Legacy home path %s exists but XDG home path %s already exists, doing nothing", legacyHomePath, xdgHomePath);
}
}
}
#endif
}
#endif // BUILD_VM

#ifdef BUILD_VM
Expand Down
1 change: 0 additions & 1 deletion src/common/FileSystem.h
Expand Up @@ -485,7 +485,6 @@ void Initialize();
#else
std::string DefaultBasePath();
std::string DefaultHomePath();
void MigrateHomePath();
void Initialize(Str::StringRef homePath, Str::StringRef libPath, const std::vector<std::string>& paths);
#endif

Expand Down