1.1 --- a/core-legacy/sourcemm.cpp Sun May 16 23:21:08 2010 -0400
1.2 +++ b/core-legacy/sourcemm.cpp Wed May 19 01:28:55 2010 -0500
1.3 @@ -1,5 +1,5 @@
1.4 /* ======== SourceMM ========
1.5 - * Copyright (C) 2004-2009 Metamod:Source Development Team
1.6 + * Copyright (C) 2004-2010 Metamod:Source Development Team
1.7 * No warranties of any kind
1.8 *
1.9 * License: zlib/libpng
1.10 @@ -336,29 +336,7 @@
1.11 g_PluginMngr.SetAlias(alias, plugin_file);
1.12 }
1.13
1.14 - /* Attempt to find a file extension */
1.15 - if (UTIL_GetExtension(plugin_file) == NULL)
1.16 - {
1.17 - g_SmmAPI.PathFormat(full_path,
1.18 - sizeof(full_path),
1.19 - "%s/%s%s",
1.20 - g_ModPath.c_str(),
1.21 - plugin_file,
1.22 -#if defined WIN32 || defined _WIN32
1.23 - ".dll"
1.24 -#else
1.25 - "_i486.so"
1.26 -#endif
1.27 - );
1.28 - }
1.29 - else
1.30 - {
1.31 - g_SmmAPI.PathFormat(full_path,
1.32 - sizeof(full_path),
1.33 - "%s/%s",
1.34 - g_ModPath.c_str(),
1.35 - plugin_file);
1.36 - }
1.37 + g_SmmAPI.GetFullPluginPath(file, full_path, sizeof(full_path));
1.38
1.39 id = g_PluginMngr.Load(full_path, Pl_File, already, error, sizeof(error));
1.40 skipped = already;
1.41 @@ -559,61 +537,21 @@
1.42 {
1.43 continue;
1.44 }
1.45 - /* First find if it's an absolute path or not... */
1.46 - if (file[0] == '/' || strncmp(&(file[1]), ":\\", 2) == 0)
1.47 + g_SmmAPI.GetFullPluginPath(file, full_path, sizeof(full_path));
1.48 + id = g_PluginMngr.Load(full_path, Pl_File, already, error, sizeof(error));
1.49 + if (id < Pl_MinId || g_PluginMngr.FindById(id)->m_Status < Pl_Paused)
1.50 {
1.51 - /* If we're in an absolute path, ignore our normal heuristics */
1.52 - id = g_PluginMngr.Load(file, Pl_File, already, error, sizeof(error));
1.53 - if (id < Pl_MinId || g_PluginMngr.FindById(id)->m_Status < Pl_Paused)
1.54 - {
1.55 - LogMessage("[META] Failed to load plugin %s. %s", buffer, error);
1.56 - }
1.57 - else
1.58 - {
1.59 - if (already)
1.60 - {
1.61 - skipped++;
1.62 - }
1.63 - else
1.64 - {
1.65 - total++;
1.66 - }
1.67 - }
1.68 + LogMessage("[META] Failed to load plugin %s. %s", buffer, error);
1.69 }
1.70 else
1.71 {
1.72 - /* Attempt to find a file extension */
1.73 - ptr = UTIL_GetExtension(file);
1.74 - /* Add an extension if there's none there */
1.75 - if (!ptr)
1.76 + if (already)
1.77 {
1.78 -#if defined WIN32 || defined _WIN32
1.79 - ext = ".dll";
1.80 -#else
1.81 - ext = "_i486.so";
1.82 -#endif
1.83 + skipped++;
1.84 }
1.85 else
1.86 {
1.87 - ext = "";
1.88 - }
1.89 - /* Format the new path */
1.90 - g_SmmAPI.PathFormat(full_path, sizeof(full_path), "%s/%s%s", g_ModPath.c_str(), file, ext);
1.91 - id = g_PluginMngr.Load(full_path, Pl_File, already, error, sizeof(error));
1.92 - if (id < Pl_MinId || g_PluginMngr.FindById(id)->m_Status < Pl_Paused)
1.93 - {
1.94 - LogMessage("[META] Failed to load plugin %s. %s", buffer, error);
1.95 - }
1.96 - else
1.97 - {
1.98 - if (already)
1.99 - {
1.100 - skipped++;
1.101 - }
1.102 - else
1.103 - {
1.104 - total++;
1.105 - }
1.106 + total++;
1.107 }
1.108 }
1.109 }