Skip to content

Commit

Permalink
Избавляемся от CPath.
Browse files Browse the repository at this point in the history
  • Loading branch information
v0lt committed Sep 13, 2024
1 parent 0dfec89 commit 3178c65
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 17 deletions.
13 changes: 7 additions & 6 deletions src/apps/mplayerc/PPageWebServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,13 +229,14 @@ void CPPageWebServer::OnBnClickedButton1()
CString dir = GetCurWebRoot();

if (PickDir(dir)) {
CPath path;

if (path.RelativePathTo(GetProgramDir(), FILE_ATTRIBUTE_DIRECTORY, dir, FILE_ATTRIBUTE_DIRECTORY)) {
dir = (LPCWSTR)path;
CStringW path;
BOOL ret = ::PathRelativePathToW(path.GetBuffer(MAX_PATH), GetProgramDir(), FILE_ATTRIBUTE_DIRECTORY, dir, FILE_ATTRIBUTE_DIRECTORY);
if (ret) {
m_WebRoot = path;
}
else {
m_WebRoot = dir;
}

m_WebRoot = dir;

UpdateData(FALSE);
SetModified();
Expand Down
15 changes: 7 additions & 8 deletions src/apps/mplayerc/PlayerPlaylistBar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3683,30 +3683,29 @@ void CPlayerPlaylistBar::OnContextMenu(CWnd* /*pWnd*/, CPoint p)

int idx = fd.m_pOFN->nFilterIndex;

CPath path(fd.GetPathName());
s.strLastSavedPlaylistDir = GetAddSlash(GetFolderPath(path));
CStringW path(fd.GetPathName());
CStringW base = GetFolderPath(path);
s.strLastSavedPlaylistDir = GetAddSlash(base);

switch (idx) {
case 1:
path.AddExtension(L".mpcpl");
path.Append(L".mpcpl");
break;
case 2:
path.AddExtension(L".pls");
path.Append(L".pls");
break;
case 3:
path.AddExtension(L".m3u");
path.Append(L".m3u");
break;
case 4:
path.AddExtension(L".asx");
path.Append(L".asx");
break;
default:
break;
}

bool fRemovePath = true;

CStringW base = GetFolderPath(path);

pos = curPlayList.GetHeadPosition();
while (pos && fRemovePath) {
CPlaylistItem& pli = curPlayList.GetNext(pos);
Expand Down
4 changes: 1 addition & 3 deletions src/apps/mplayerc/stdafx.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* (C) 2003-2006 Gabest
* (C) 2006-2023 see Authors.txt
* (C) 2006-2024 see Authors.txt
*
* This file is part of MPC-BE.
*
Expand Down Expand Up @@ -42,8 +42,6 @@
#include "stdafx_common_dshow.h"
#include <qnetwork.h>

#include <atlpath.h>

#include <cmath>
#include <algorithm>
#include <memory>
Expand Down

0 comments on commit 3178c65

Please sign in to comment.