summaryrefslogtreecommitdiff
path: root/ExtraSocket.cpp
diff options
context:
space:
mode:
authorThomas Preud'homme <robotux@celest.fr>2013-01-04 14:50:19 +0100
committerThomas Preud'homme <robotux@celest.fr>2013-01-04 14:50:19 +0100
commit8f9f382e1c97cab2e72e97495650c73ac4b97314 (patch)
tree78510a0d81368c09b56f444fb19bb132c8bc3009 /ExtraSocket.cpp
Imported Upstream version 0.3.0.5
Diffstat (limited to 'ExtraSocket.cpp')
-rw-r--r--ExtraSocket.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/ExtraSocket.cpp b/ExtraSocket.cpp
new file mode 100644
index 0000000..08b0979
--- /dev/null
+++ b/ExtraSocket.cpp
@@ -0,0 +1,32 @@
+/** \file ExtraSocket.h
+\brief Define the socket of ultracopier
+\author alpha_one_x86
+\version 0.3
+\date 2010
+\licence GPL3, see the file COPYING */
+
+#include "ExtraSocket.h"
+
+QString ExtraSocket::pathSocket(const QString &name)
+{
+#ifdef Q_OS_UNIX
+ return name+"-"+QString::number(getuid());
+#else
+ QString userName;
+ DWORD size=0;
+ if(GetUserNameW(NULL,&size) || (GetLastError()!=ERROR_INSUFFICIENT_BUFFER))
+ {
+ }
+ else
+ {
+ WCHAR * userNameW=new WCHAR[size];
+ if(GetUserNameW(userNameW,&size))
+ {
+ userName.fromWCharArray(userNameW,size*2);
+ userName=QString(QByteArray((char*)userNameW,size*2-2).toHex());
+ }
+ delete userNameW;
+ }
+ return name+"-"+userName;
+#endif
+}