summaryrefslogtreecommitdiff
path: root/ExtraSocket.cpp
diff options
context:
space:
mode:
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
+}