From e9b29523c2de6a360c223e22e19b6f9bab51a887 Mon Sep 17 00:00:00 2001 From: Stas Degteff Date: Tue, 27 Sep 2005 16:31:00 +0000 Subject: [PATCH] Golded+/lnx: Adopt clipboard to newest MC versions. --- goldlib/gall/gutlunix.cpp | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/goldlib/gall/gutlunix.cpp b/goldlib/gall/gutlunix.cpp index 7d2a292..5d99c1c 100644 --- a/goldlib/gall/gutlunix.cpp +++ b/goldlib/gall/gutlunix.cpp @@ -34,9 +34,11 @@ // ------------------------------------------------------------------ +// Midnight Commander's clipboard support -#define CLIPDIR "~/.cedit" -#define CLIPFILE "~/.cedit/cooledit.clip" +#define CLIPDIR "~/.mc/cedit/" +#define CLIPDIR_OLD "~/.cedit/" +#define CLIPFILE "cooledit.clip" // ------------------------------------------------------------------ @@ -90,10 +92,17 @@ void g_set_osicon(void) { // ------------------------------------------------------------------ bool g_is_clip_available(void) { + bool rc; std::string clipdir = CLIPDIR; strschg_environ(clipdir); - return is_dir(clipdir); + rc = is_dir(clipdir); + if( !rc ) { + std::string clipdir = CLIPDIR_OLD; + strschg_environ(clipdir); + rc = is_dir(clipdir); + } + return rc; } @@ -101,7 +110,8 @@ bool g_is_clip_available(void) { char* g_get_clip_text(void) { - std::string clipfile = CLIPFILE; + std::string clipfile = clipdir + clipfile += CLIPFILE; strschg_environ(clipfile); size_t size = GetFilesize(clipfile.c_str()); @@ -127,7 +137,8 @@ char* g_get_clip_text(void) { int g_put_clip_text(const char* buf) { - std::string clipfile = CLIPFILE; + std::string clipfile = clipdir; + clipfile += CLIPFILE; strschg_environ(clipfile); FILE *f = fopen(clipfile.c_str(), "wt"); if(f != NULL) {