Permalink
Browse files

Move 'make file hidden' to eDocumentPath.

  • Loading branch information...
1 parent 9465ecb commit dcc2669f13ec282b04e2b2be5f87d56ec3aa96cc @adamv adamv committed with adamv Nov 2, 2009
Showing with 20 additions and 15 deletions.
  1. +8 −10 src/ProjectInfo.cpp
  2. +11 −5 src/eDocumentPath.cpp
  3. +1 −0 src/eDocumentPath.h
View
@@ -5,6 +5,10 @@
#include "tinyxml.h"
#include "EasyPlistWriter.h"
+#ifdef __WXMSW__
+#include "eDocumentPath.h"
+#endif
+
cxProjectInfo::cxProjectInfo(): isRoot(false), hasFilters(false) {};
cxProjectInfo::cxProjectInfo(const cxProjectInfo& info) {
@@ -70,9 +74,8 @@ static bool projectinfo_match(const wxString& path, const wxArrayString& include
}
for (unsigned int i = 0; i < excludes.GetCount(); ++i) {
- if (wxMatchWild(excludes[i], path, false)) {
+ if (wxMatchWild(excludes[i], path, false))
return false;
- }
}
return true;
@@ -86,7 +89,6 @@ bool cxProjectInfo::IsDirectoryIncluded(const wxString& dir_name) const {
return projectinfo_match(dir_name, includeDirs, excludeDirs);
}
-
bool cxProjectInfo::Load(const wxFileName& rootPath, const wxString& path, bool onlyFilters) {
wxFileName projectPath(path, wxEmptyString);
this->path = path;
@@ -140,9 +142,7 @@ bool cxProjectInfo::Load(const wxFileName& rootPath, const wxString& path, bool
const char* pattern = child->GetText();
if (pattern) filterArray->Add(wxString(pattern, wxConvUTF8));
}
- else {
- wxASSERT(false);
- }
+ else wxASSERT(false);
}
filter = array; // jump over value
@@ -163,9 +163,8 @@ bool cxProjectInfo::Load(const wxFileName& rootPath, const wxString& path, bool
if (strcmp(val->Value(), "string") != 0) return false; // invalid dict
const char* value = val->GetText();
- if (key) {
+ if (key)
this->env[wxString(key, wxConvUTF8)] = value ? wxString(value, wxConvUTF8) : *wxEmptyString;
- }
env = val; // jump over value
}
@@ -246,7 +245,6 @@ void cxProjectInfo::Save(const wxString& rootPath) const {
eprj.Save(filepath);
#ifdef __WXMSW__
- DWORD dwAttrs = ::GetFileAttributes(filepath.c_str());
- ::SetFileAttributes(filepath.c_str(), dwAttrs | FILE_ATTRIBUTE_HIDDEN);
+ eDocumentPath::MakeHidden(filepath);
#endif //__WXMSW__
}
View
@@ -15,11 +15,9 @@ eDocumentPath::~eDocumentPath(void){}
bool eDocumentPath::MakeWritable(const wxString& path) {
#ifdef __WXMSW__
DWORD dwAttrs = ::GetFileAttributes(path);
- if (dwAttrs & FILE_ATTRIBUTE_READONLY) {
- dwAttrs &= ~FILE_ATTRIBUTE_READONLY;
- return SetFileAttributes(path, dwAttrs) != 0;
- }
- else return true;
+ if (!(dwAttrs & FILE_ATTRIBUTE_READONLY)) return true;
+ dwAttrs &= ~FILE_ATTRIBUTE_READONLY;
+ return SetFileAttributes(path, dwAttrs) != 0;
#else
// Get protection
struct stat s;
@@ -29,6 +27,14 @@ bool eDocumentPath::MakeWritable(const wxString& path) {
#endif
}
+#ifdef __WXMSW__
+bool eDocumentPath::MakeHidden(const wxString& path) {
+ DWORD dwAttrs = ::GetFileAttributes(path);
+ if (dwAttrs & FILE_ATTRIBUTE_HIDDEN) return true;
+ return ::SetFileAttributes(path, dwAttrs | FILE_ATTRIBUTE_HIDDEN) != 0;
+}
+#endif
+
FILE_PERMISSIONS eDocumentPath::GetPermissions(const wxString& path) {
#ifdef __WXMSW__
return ::GetFileAttributes(path);
View
@@ -36,6 +36,7 @@ class eDocumentPath
static bool SetPermissions(const wxString& path, FILE_PERMISSIONS permissions);
#ifdef __WXMSW__
+ static bool MakeHidden(const wxString& path);
static wxString GetCygwinDir();
static wxString GetCygdrivePrefix();

0 comments on commit dcc2669

Please sign in to comment.