| 106 | //----------------------------------------------------------------------------- |
| 107 | |
| 108 | static void Snapshot_SetPathname(const std::string& strPathname) |
| 109 | { |
| 110 | if (strPathname.empty()) |
| 111 | { |
| 112 | g_strSaveStateFilename = DEFAULT_SNAPSHOT_NAME; |
| 113 | |
| 114 | g_strSaveStatePathname = g_sCurrentDir; |
| 115 | if (!g_strSaveStatePathname.empty() && *g_strSaveStatePathname.rbegin() != PATH_SEPARATOR) |
| 116 | g_strSaveStatePathname += PATH_SEPARATOR; |
| 117 | g_strSaveStatePathname.append(DEFAULT_SNAPSHOT_NAME); |
| 118 | |
| 119 | g_strSaveStatePath = g_sCurrentDir; |
| 120 | return; |
| 121 | } |
| 122 | |
| 123 | std::string strFilename = strPathname; // Set default, as maybe there's no path |
| 124 | g_strSaveStatePath.clear(); |
| 125 | |
| 126 | size_t nIdx = strPathname.find_last_of(PATH_SEPARATOR); |
| 127 | if (nIdx >= 0 && nIdx+1 < (int)strPathname.length()) // path exists? |
| 128 | { |
| 129 | strFilename = &strPathname[nIdx+1]; |
| 130 | g_strSaveStatePath = strPathname.substr(0, nIdx+1); // Bugfix: 1.25.0.2 // Snapshot_LoadState() -> SetCurrentImageDir() -> g_sCurrentDir |
| 131 | } |
| 132 | |
| 133 | g_strSaveStateFilename = strFilename; |
| 134 | g_strSaveStatePathname = strPathname; |
| 135 | } |
| 136 | |
| 137 | void Snapshot_SetFilename(const std::string& filename, const std::string& path/*=""*/) |
| 138 | { |
no test coverage detected