| 99 | } |
| 100 | |
| 101 | int FTPClientWrapperSSL::GetDir(const char * path, FTPFile** files) { |
| 102 | int retcode = 0; |
| 103 | CUT_DIRINFO di; |
| 104 | FTPFile * ftpfiles; |
| 105 | |
| 106 | //store original directory |
| 107 | //commented out: Cwd is not used in NppFTP at the moment |
| 108 | //char curpath[MAX_PATH]; |
| 109 | //retcode = m_client.GetCurDir(curpath, MAX_PATH); |
| 110 | //if (retcode != UTE_SUCCESS) |
| 111 | // return OnReturn(-1); |
| 112 | |
| 113 | // change the current working directory to the one specified |
| 114 | retcode = m_client.ChDir(path); |
| 115 | if (retcode != UTE_SUCCESS) |
| 116 | return OnReturn(-1); |
| 117 | |
| 118 | if (strlen(m_ftpListParams) > 0) |
| 119 | retcode = m_client.GetDirInfo(m_ftpListParams);//path); |
| 120 | else |
| 121 | retcode = m_client.GetDirInfo();//path); |
| 122 | |
| 123 | //return to original directory |
| 124 | //commented out: Cwd is not used in NppFTP at the moment |
| 125 | //m_client.ChDir(curpath); |
| 126 | |
| 127 | if (retcode != UTE_SUCCESS) { |
| 128 | return OnReturn(-1); |
| 129 | } |
| 130 | |
| 131 | bool endslash = path[strlen(path)-1] == '/'; |
| 132 | |
| 133 | if (retcode != UTE_SUCCESS) |
| 134 | { |
| 135 | return OnReturn(-1); |
| 136 | } |
| 137 | |
| 138 | int count = m_client.GetDirInfoCount(); |
| 139 | |
| 140 | std::vector<FTPFile> vfiles; |
| 141 | |
| 142 | for(int i = 0; i < count; i++) { |
| 143 | m_client.GetDirEntry(i,&di); |
| 144 | |
| 145 | if (!lstrcmp(TEXT("."), di.fileName) || !lstrcmp(TEXT(".."), di.fileName)) |
| 146 | continue; |
| 147 | |
| 148 | FTPFile ftpfile{}; |
| 149 | |
| 150 | ftpfile.filePath[0] = 0; |
| 151 | |
| 152 | char * utf8name = SU::TCharToUtf8(di.fileName); |
| 153 | char nameCpy[MAX_PATH+1]; //buffer used to handle symlinks |
| 154 | |
| 155 | strncpy(nameCpy, utf8name, MAX_PATH); |
| 156 | nameCpy[MAX_PATH] = '\0'; |
| 157 | SU::FreeChar(utf8name); |
| 158 |
no test coverage detected