mirror of
https://github.com/likle/cwalk.git
synced 2026-10-28 09:44:01 +00:00
added the cwk_path_change_root function
This commit is contained in:
1 parent
81d5affec9
commit
35fc783fcd
6 files changed
+212
-1
No files matched your search
+82
-1
@@ -1,6 +1,88 @@
|
||||
#include <cwalk.h>
|
||||
#include <memory.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int root_change_overlapping()
|
||||
{
|
||||
size_t length;
|
||||
char buffer[FILENAME_MAX] = "C:\\hello\\world.txt";
|
||||
|
||||
cwk_path_set_style(CWK_STYLE_WINDOWS);
|
||||
length = cwk_path_change_root(buffer, "D:\\path\\", buffer,
|
||||
sizeof(buffer));
|
||||
|
||||
if (length != 23) {
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
if (strcmp(buffer, "D:\\path\\hello\\world.txt") != 0) {
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
int root_change_separators()
|
||||
{
|
||||
size_t length;
|
||||
char buffer[FILENAME_MAX];
|
||||
|
||||
cwk_path_set_style(CWK_STYLE_WINDOWS);
|
||||
length = cwk_path_change_root("C:\\hello\\world.txt", "D:\\path\\", buffer,
|
||||
sizeof(buffer));
|
||||
|
||||
if (length != 23) {
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
if (strcmp(buffer, "D:\\path\\hello\\world.txt") != 0) {
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
int root_change_empty()
|
||||
{
|
||||
size_t length;
|
||||
char buffer[FILENAME_MAX];
|
||||
|
||||
cwk_path_set_style(CWK_STYLE_WINDOWS);
|
||||
length = cwk_path_change_root("C:\\hello\\world.txt", "", buffer,
|
||||
sizeof(buffer));
|
||||
|
||||
if (length != 15) {
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
if (strcmp(buffer, "hello\\world.txt") != 0) {
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
int root_change_simple()
|
||||
{
|
||||
size_t length;
|
||||
char buffer[FILENAME_MAX];
|
||||
|
||||
cwk_path_set_style(CWK_STYLE_WINDOWS);
|
||||
length = cwk_path_change_root("C:\\hello\\world.txt", "D:\\", buffer,
|
||||
sizeof(buffer));
|
||||
|
||||
if (length != 18) {
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
if (strcmp(buffer, "D:\\hello\\world.txt") != 0) {
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
int root_relative_windows()
|
||||
{
|
||||
size_t length;
|
||||
@@ -141,7 +223,6 @@ int root_windows_slash()
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
int root_windows_backslash()
|
||||
{
|
||||
size_t length;
|
||||
|
||||
Reference in new issue
Block a user