char *path = (id->lib)? id->lib->filename: G.sce;
BLI_strncpy(filename, external->filename, FILE_MAX);
- BLI_convertstringcode(filename, path);
+ BLI_path_abs(filename, path);
}
void CustomData_external_read(CustomData *data, ID *id, CustomDataMask mask, int totelem)
strcat(targetDir,"fluidsurface_final_####");
}
- BLI_convertstringcode(targetDir, G.sce);
- BLI_convertstringframe(targetDir, curFrame, 0); // fixed #frame-no
+ BLI_path_abs(targetDir, G.sce);
+ BLI_path_frame(targetDir, curFrame, 0); // fixed #frame-no
strcpy(targetFile,targetDir);
strcat(targetFile, ".bobj.gz");
}
BLI_strncpy(str, name, sizeof(str));
- BLI_convertstringcode(str, G.sce);
+ BLI_path_abs(str, G.sce);
/* exists? */
file= open(str, O_BINARY|O_RDONLY);
for(ima= G.main->image.first; ima; ima= ima->id.next) {
if(ima->source!=IMA_SRC_VIEWER && ima->source!=IMA_SRC_GENERATED) {
BLI_strncpy(strtest, ima->name, sizeof(ima->name));
- BLI_convertstringcode(strtest, G.sce);
+ BLI_path_abs(strtest, G.sce);
if( strcmp(strtest, str)==0 ) {
if(ima->anim==NULL || ima->id.us==0) {
{
if (string==NULL) return;
BLI_strncpy(string, base, FILE_MAX - 10); /* weak assumption */
- BLI_convertstringcode(string, G.sce);
- BLI_convertstringframe(string, frame, 4);
+ BLI_path_abs(string, G.sce);
+ BLI_path_frame(string, frame, 4);
if(use_ext)
BKE_add_image_extension(string, imtype);
BLI_strncpy(name, ima->name, sizeof(name));
if(ima->id.lib)
- BLI_convertstringcode(name, ima->id.lib->filename);
+ BLI_path_abs(name, ima->id.lib->filename);
else
- BLI_convertstringcode(name, G.sce);
+ BLI_path_abs(name, G.sce);
/* read ibuf */
ibuf = IMB_loadiffname(name, IB_rect|IB_multilayer);
BLI_strncpy(str, ima->name, FILE_MAX);
if(ima->id.lib)
- BLI_convertstringcode(str, ima->id.lib->filename);
+ BLI_path_abs(str, ima->id.lib->filename);
else
- BLI_convertstringcode(str, G.sce);
+ BLI_path_abs(str, G.sce);
ima->anim = openanim(str, IB_cmap | IB_rect);
/* get the right string */
BLI_strncpy(str, ima->name, sizeof(str));
if(ima->id.lib)
- BLI_convertstringcode(str, ima->id.lib->filename);
+ BLI_path_abs(str, ima->id.lib->filename);
else
- BLI_convertstringcode(str, G.sce);
+ BLI_path_abs(str, G.sce);
- BLI_convertstringframe(str, cfra, 0);
+ BLI_path_frame(str, cfra, 0);
/* read ibuf */
ibuf = IMB_loadiffname(str, IB_rect|IB_multilayer|IB_imginfo);
{
if(ima->id.lib==NULL) return;
if(strncmp(ima->name, "//", 2)==0) {
- BLI_convertstringcode(ima->name, ima->id.lib->filename);
- BLI_makestringcode(G.sce, ima->name);
+ BLI_path_abs(ima->name, ima->id.lib->filename);
+ BLI_path_rel(ima->name, G.sce);
}
}
// convert relative filenames to absolute filenames
strcpy(name, filename);
- BLI_convertstringcode(name, G.sce);
+ BLI_path_abs(name, G.sce);
// open the file
// and create a PackedFile structure
if (guimode); //XXX waitcursor(1);
strcpy(name, filename);
- BLI_convertstringcode(name, G.sce);
+ BLI_path_abs(name, G.sce);
if (BLI_exists(name)) {
for (number = 1; number <= 999; number++) {
char name[FILE_MAXDIR + FILE_MAXFILE];
strcpy(name, filename);
- BLI_convertstringcode(name, G.sce);
+ BLI_path_abs(name, G.sce);
if (stat(name, &st)) {
ret_val = PF_NOFILE;
// ok, start loading
strcpy(filename, fss->surfdataPath);
strcat(filename, suffix);
- BLI_convertstringcode(filename, G.sce);
- BLI_convertstringframe(filename, curFrame, 0); // fixed #frame-no
+ BLI_path_abs(filename, G.sce);
+ BLI_path_frame(filename, curFrame, 0); // fixed #frame-no
strcat(filename, suffix2);
gzf = gzopen(filename, "rb");
file[i-6] = '\0';
snprintf(filename, MAX_PTCACHE_PATH, "//"PTCACHE_PATH"%s", file); /* add blend file name to pointcache dir */
- BLI_convertstringcode(filename, blendfilename);
+ BLI_path_abs(filename, blendfilename);
return BLI_add_slash(filename); /* new strlen() */
}
if (seq->type != SEQ_SCENE && seq->type != SEQ_META &&
seq->type != SEQ_IMAGE) {
BLI_join_dirfile(str, seq->strip->dir, seq->strip->stripdata->name);
- BLI_convertstringcode(str, G.sce);
+ BLI_path_abs(str, G.sce);
}
if (seq->type == SEQ_IMAGE) {
if (seq->flag & SEQ_USE_PROXY_CUSTOM_FILE) {
BLI_join_dirfile(name, dir, seq->strip->proxy->file);
- BLI_convertstringcode(name, G.sce);
+ BLI_path_abs(name, G.sce);
return TRUE;
}
render_size);
}
- BLI_convertstringcode(name, G.sce);
- BLI_convertstringframe(name, frameno, 0);
+ BLI_path_abs(name, G.sce);
+ BLI_path_frame(name, frameno, 0);
strcat(name, ".jpg");
if(se->ok == STRIPELEM_OK && se->ibuf == 0) {
StripElem * s_elem = give_stripelem(seq, cfra);
BLI_join_dirfile(name, seq->strip->dir, s_elem->name);
- BLI_convertstringcode(name, G.sce);
+ BLI_path_abs(name, G.sce);
if (!build_proxy_run) {
se->ibuf = seq_proxy_fetch(scene, seq, cfra, render_size);
}
if (se->ibuf == 0) {
if(seq->anim==0) {
BLI_join_dirfile(name, seq->strip->dir, seq->strip->stripdata->name);
- BLI_convertstringcode(name, G.sce);
+ BLI_path_abs(name, G.sce);
seq->anim = openanim(
name, IB_rect |
int len;
strcpy(str, filename);
- BLI_convertstringcode(str, bmain->name);
+ BLI_path_abs(str, bmain->name);
len = strlen(filename);
while(len > 0 && filename[len-1] != '/' && filename[len-1] != '\\')
else
path = bmain ? bmain->name : G.sce;
- BLI_convertstringcode(fullpath, path);
+ BLI_path_abs(fullpath, path);
/* but we need a packed file then */
if (pf)
if (!text || !text->name) return 0;
BLI_strncpy(str, text->name, FILE_MAXDIR+FILE_MAXFILE);
- BLI_convertstringcode(str, G.sce);
+ BLI_path_abs(str, G.sce);
BLI_split_dirfile(str, NULL, sfile);
fp= fopen(str, "r");
BLI_strncpy(str, file, FILE_MAXDIR+FILE_MAXFILE);
if (relpath) /* can be NULL (bg mode) */
- BLI_convertstringcode(str, relpath);
+ BLI_path_abs(str, relpath);
BLI_split_dirfile(str, NULL, sfile);
fp= fopen(str, "r");
if (string==NULL) return;
strcpy(string, rd->pic);
- BLI_convertstringcode(string, G.sce);
+ BLI_path_abs(string, G.sce);
BLI_make_existing_file(string);
if (!BLI_testextensie(string, ".avi")) {
- BLI_convertstringframe_range(string, rd->sfra, rd->efra, 4);
+ BLI_path_frame_range(string, rd->sfra, rd->efra, 4);
strcat(string, ".avi");
}
}
if (!string || !exts) return;
strcpy(string, rd->pic);
- BLI_convertstringcode(string, G.sce);
+ BLI_path_abs(string, G.sce);
BLI_make_existing_file(string);
if (!*fe) {
strcat(string, autosplit);
- BLI_convertstringframe_range(string, rd->sfra, rd->efra, 4);
+ BLI_path_frame_range(string, rd->sfra, rd->efra, 4);
strcat(string, *exts);
} else {
*(string + strlen(string) - strlen(*fe)) = 0;
* @a framenum The framenumber to replace the frame code with.
* @retval Returns true if the path was relative (started with "//").
*/
-int BLI_convertstringcode(char *path, const char *basepath);
-int BLI_convertstringframe(char *path, int frame, int digits);
-int BLI_convertstringframe_range(char *path, int sta, int end, int digits);
-int BLI_convertstringcwd(char *path);
+int BLI_path_abs(char *path, const char *basepath);
+int BLI_path_frame(char *path, int frame, int digits);
+int BLI_path_frame_range(char *path, int sta, int end, int digits);
+int BLI_path_cwd(char *path);
-void BLI_makestringcode(const char *relfile, char *file);
+void BLI_path_rel(char *file, const char *relfile);
/**
* Change every @a from in @a string into @a to. The
libpath = BLI_bpathIterator_getLib(bpi);
if (libpath) { /* check the files location relative to its library path */
- BLI_convertstringcode(path_expanded, libpath);
+ BLI_path_abs(path_expanded, libpath);
} else { /* local data, use the blend files path */
- BLI_convertstringcode(path_expanded, bpi->base_path);
+ BLI_path_abs(path_expanded, bpi->base_path);
}
}
char* BLI_bpathIterator_getLib( struct BPathIterator *bpi) {
/* Important BLI_cleanup_dir runs before the path is made relative
* because it wont work for paths that start with "//../" */
BLI_cleanup_file(bpi.base_path, filepath_relative); /* fix any /foo/../foo/ */
- BLI_makestringcode(bpi.base_path, filepath_relative);
+ BLI_path_rel(filepath_relative, bpi.base_path);
/* be safe and check the length */
if (BLI_bpathIterator_getPathMaxLen(&bpi) <= strlen(filepath_relative)) {
bpath_as_report(&bpi, "couldn't make path relative (too long)", reports);
} else {
/* copy the found path into the old one */
if (G.relbase_valid)
- BLI_makestringcode(bpi.base_path, filename_new);
+ BLI_path_rel(filename_new, bpi.base_path);
BLI_bpathIterator_setPath( &bpi, filename_new );
}
short a;
char *start, *eind;
if (relabase) {
- BLI_convertstringcode(dir, relabase);
+ BLI_path_abs(dir, relabase);
} else {
if (dir[0]=='/' && dir[1]=='/') {
if (dir[2]== '\0') {
}
-void BLI_makestringcode(const char *relfile, char *file)
+void BLI_path_rel(char *file, const char *relfile)
{
char * p;
char * q;
}
}
-int BLI_convertstringframe(char *path, int frame, int digits)
+int BLI_path_frame(char *path, int frame, int digits)
{
int ch_sta, ch_end;
return 0;
}
-int BLI_convertstringframe_range(char *path, int sta, int end, int digits)
+int BLI_path_frame_range(char *path, int sta, int end, int digits)
{
int ch_sta, ch_end;
return 0;
}
-int BLI_convertstringcode(char *path, const char *basepath)
+int BLI_path_abs(char *path, const char *basepath)
{
int wasrelative = (strncmp(path, "//", 2)==0);
char tmp[FILE_MAX];
* Should only be done with command line paths.
* this is NOT somthing blenders internal paths support like the // prefix
*/
-int BLI_convertstringcwd(char *path)
+int BLI_path_cwd(char *path)
{
int wasrelative = 1;
int filelen = strlen(path);
BLI_strncpy(path, src_dir, sizeof(path));
/* expand "//" in filename and get absolute path */
- BLI_convertstringcode(path, base_dir);
+ BLI_path_abs(path, base_dir);
/* get the directory part */
BLI_split_dirfile(path, dir, base);
* relative to the blend file since indirectly linked libs will be relative to their direct linked library */
if (strncmp(lib->name, "//", 2)==0) { /* if this is relative to begin with? */
strncpy(lib->name, lib->filename, sizeof(lib->name));
- BLI_makestringcode(basepath, lib->name);
+ BLI_path_rel(lib->name, basepath);
}
}
}
{
char str[FILE_MAX];
BLI_join_dirfile(str, seq->strip->dir, seq->strip->stripdata->name);
- BLI_convertstringcode(str, G.sce);
+ BLI_path_abs(str, G.sce);
seq->sound = sound_new_file(main, str);
}
}
read_libraries(*fd, &(*fd)->mainlist);
/* make the lib path relative if required */
- if(flag & FILE_STRINGCODE) {
+ if(flag & FILE_RELPATH) {
/* use the full path, this could have been read by other library even */
BLI_strncpy(mainl->curlib->name, mainl->curlib->filename, sizeof(mainl->curlib->name));
/* uses current .blend file as reference */
- BLI_makestringcode(G.sce, mainl->curlib->name);
+ BLI_path_rel(mainl->curlib->name, G.sce);
}
blo_join_main(&(*fd)->mainlist);
// make absolute source path
BLI_strncpy(src, image->name, sizeof(src));
- BLI_convertstringcode(src, G.sce);
+ BLI_path_abs(src, G.sce);
// make dest directory if it doesn't exist
BLI_make_existing_file(abs);
int err;
strcpy(tmpStr, G.selfont->name);
- BLI_convertstringcode(tmpStr, G.sce);
+ BLI_path_abs(tmpStr, G.sce);
err = FTF_SetFont((unsigned char *)tmpStr, 0, 14.0);
}
}
RNA_string_get(op->ptr, "path", path);
if(G.save_over)
- BLI_makestringcode(G.sce, path); /* make relative */
+ BLI_path_rel(path, G.sce);
CustomData_external_add(&me->fdata, &me->id, CD_MDISPS, me->totface, path);
CustomData_external_write(&me->fdata, &me->id, CD_MASK_MESH, me->totface, 0);
// prepare names...
strncpy(targetDir, domainSettings->surfdataPath, FILE_MAXDIR);
strncpy(newSurfdataPath, domainSettings->surfdataPath, FILE_MAXDIR);
- BLI_convertstringcode(targetDir, G.sce); // fixed #frame-no
+ BLI_path_abs(targetDir, G.sce); // fixed #frame-no
strcpy(targetFile, targetDir);
strcat(targetFile, suffixConfig);
if(selection<1) return 0; // 0 from menu, or -1 aborted
strcpy(targetDir, newSurfdataPath);
strncpy(domainSettings->surfdataPath, newSurfdataPath, FILE_MAXDIR);
- BLI_convertstringcode(targetDir, G.sce); // fixed #frame-no
+ BLI_path_abs(targetDir, G.sce); // fixed #frame-no
}
// --------------------------------------------------------------------------------------------
RNA_string_get(op->ptr, "path", path);
strcpy(G.ima, path);
- BLI_convertstringcode(path, G.sce);
+ BLI_path_abs(path, G.sce);
/* BKE_add_image_extension() checks for if extension was already set */
if(scene->r.scemode & R_EXTENSION)
if(RNA_struct_find_property(op->ptr, "relative_path"))
if(RNA_boolean_get(op->ptr, "relative_path"))
- BLI_makestringcode(G.sce, name);
+ BLI_path_rel(name, G.sce);
RNA_string_set(op->ptr, "path", name);
BLI_cleanup_dir(G.sce, params->dir);
} else {
/* if operator has path set, use it, otherwise keep the last */
- BLI_convertstringcode(name, G.sce);
+ BLI_path_abs(name, G.sce);
BLI_split_dirfile(name, dir, file);
BLI_strncpy(params->file, file, sizeof(params->file));
BLI_make_file_string(G.sce, params->dir, dir, ""); /* XXX needed ? - also solve G.sce */
BKE_add_image_extension(name, scene->r.imtype);
strcpy(str, name);
- BLI_convertstringcode(str, G.sce);
+ BLI_path_abs(str, G.sce);
if (confirm)
overwrite = saveover(str);
if (ibuf) {
int relative= RNA_boolean_get(op->ptr, "relative_path");
- BLI_convertstringcode(path, G.sce);
+ BLI_path_abs(path, G.sce);
if(scene->r.scemode & R_EXTENSION) {
BKE_add_image_extension(path, sima->imtypenr);
RE_WriteRenderResult(rr, path, scene->r.quality);
if(relative)
- BLI_makestringcode(G.sce, path); /* only after saving */
+ BLI_path_rel(path, G.sce); /* only after saving */
BLI_strncpy(ima->name, path, sizeof(ima->name));
BLI_strncpy(ibuf->name, path, sizeof(ibuf->name));
char *name;
if(relative)
- BLI_makestringcode(G.sce, path); /* only after saving */
+ BLI_path_rel(path, G.sce); /* only after saving */
BLI_strncpy(ima->name, path, sizeof(ima->name));
BLI_strncpy(ibuf->name, path, sizeof(ibuf->name));
char name[FILE_MAX];
BLI_strncpy(name, ibuf->name, sizeof(name));
- BLI_convertstringcode(name, G.sce);
+ BLI_path_abs(name, G.sce);
if(0 == IMB_saveiff(ibuf, name, IB_rect | IB_zbuf | IB_zbuffloat)) {
BKE_reportf(op->reports, RPT_ERROR, "Could not write image %s.", name);
if (te->idcode == ID_LI) {
char expanded[FILE_MAXDIR + FILE_MAXFILE];
BLI_strncpy(expanded, ((Library *)tselem->id)->name, FILE_MAXDIR + FILE_MAXFILE);
- BLI_convertstringcode(expanded, G.sce);
+ BLI_path_abs(expanded, G.sce);
if (!BLI_exists(expanded)) {
error("This path does not exist, correct this before saving");
}
char file[FILE_MAXDIR+FILE_MAXFILE];
BLI_strncpy(file, text->name, FILE_MAXDIR+FILE_MAXFILE);
- BLI_convertstringcode(file, G.sce);
+ BLI_path_abs(file, G.sce);
fp= fopen(file, "w");
if(fp==NULL) {
return 0;
BLI_strncpy(file, text->name, FILE_MAXDIR+FILE_MAXFILE);
- BLI_convertstringcode(file, G.sce);
+ BLI_path_abs(file, G.sce);
if(!BLI_exists(file))
return 2;
if(!text || !text->name) return;
BLI_strncpy(file, text->name, FILE_MAXDIR+FILE_MAXFILE);
- BLI_convertstringcode(file, G.sce);
+ BLI_path_abs(file, G.sce);
if(!BLI_exists(file)) return;
/* sfile->flag and simasel->flag */
#define FILE_SHOWSHORT 1
-#define FILE_STRINGCODE 2
+#define FILE_RELPATH 2 /* was FILE_STRINGCODE */
#define FILE_LINK 4
#define FILE_HIDE_DOT 8
#define FILE_AUTOSELECT 16
#define C_HI 0xCBBBBB
#define C_LO 0x544444
-/* queue settings */
-#define IMS_KNOW_WIN 1
-#define IMS_KNOW_BIP 2
-#define IMS_KNOW_DIR 4
-#define IMS_DOTHE_INF 8
-#define IMS_KNOW_INF 16
-#define IMS_DOTHE_IMA 32
-#define IMS_KNOW_IMA 64
-#define IMS_FOUND_BIP 128
-#define IMS_DOTHE_BIP 256
-#define IMS_WRITE_NO_BIP 512
-
-/* imasel->mode */
-#define IMS_NOIMA 0
-#define IMS_IMA 1
-#define IMS_ANIM 2
-#define IMS_DIR 4
-#define IMS_FILE 8
-#define IMS_STRINGCODE 16
-
-#define IMS_INDIR 1
-#define IMS_INDIRSLI 2
-#define IMS_INFILE 3
-#define IMS_INFILESLI 4
-
/* nla->flag */
/* flags (1<<0), (1<<1), and (1<<3) are depreceated flags from old blenders */
/* draw timing in seconds instead of frames */
if(ibuf) {
char filename[FILE_MAXDIR + FILE_MAXFILE];
BLI_strncpy(filename, image->name, sizeof(filename));
- BLI_convertstringcode(filename, G.sce);
+ BLI_path_abs(filename, G.sce);
if(image->packedfile) {
if (writePackedFile(reports, image->name, image->packedfile, 0) != RET_OK) {
if (strchr(string, '#')==NULL)
strcat(string, "####"); /* 4 numbers */
- BLI_convertstringframe_range(string, rd->sfra, rd->efra, 4);
+ BLI_path_frame_range(string, rd->sfra, rd->efra, 4);
strcat(string, ".mov");
}
}
if (string==0) return;
strcpy(string, rd->pic);
- BLI_convertstringcode(string, G.sce);
+ BLI_path_abs(string, G.sce);
BLI_make_existing_file(string);
char name[256];
strcpy(name, re->r.backbuf);
- BLI_convertstringcode(name, G.sce);
- BLI_convertstringframe(name, re->r.cfra, 0);
+ BLI_path_abs(name, G.sce);
+ BLI_path_frame(name, re->r.cfra, 0);
if(re->backbuf) {
re->backbuf->id.us--;
if(RNA_boolean_get(op->ptr, "autoselect")) flag |= FILE_AUTOSELECT;
if(RNA_boolean_get(op->ptr, "active_layer")) flag |= FILE_ACTIVELAY;
- if(RNA_boolean_get(op->ptr, "relative_path")) flag |= FILE_STRINGCODE;
+ if(RNA_boolean_get(op->ptr, "relative_path")) flag |= FILE_RELPATH;
if(RNA_boolean_get(op->ptr, "link")) flag |= FILE_LINK;
if(RNA_boolean_get(op->ptr, "instance_groups")) flag |= FILE_GROUP_INSTANCE;
return flag;
/* Make the path absolute because its needed for relative linked blends to be found */
char filename[FILE_MAXDIR + FILE_MAXFILE];
BLI_strncpy(filename, argv[1], sizeof(filename));
- BLI_convertstringcwd(filename);
+ BLI_path_cwd(filename);
/* workaround for scripts not getting a bpy.context.scene, causes internal errors elsewhere */
if (argc > 1) {
/* Make the path absolute because its needed for relative linked blends to be found */
char filename[FILE_MAXDIR + FILE_MAXFILE];
BLI_strncpy(filename, argv[0], sizeof(filename));
- BLI_convertstringcwd(filename);
+ BLI_path_cwd(filename);
if (G.background) {
int retval = BKE_read_file(C, filename, NULL, NULL);
// to the first file but that makes no sense, relative paths in
// blend files should be relative to that file, not some other file
// that happened to be loaded first
- BLI_convertstringcode(basedpath, pathname);
+ BLI_path_abs(basedpath, pathname);
bfd = load_game_data(basedpath);
// if it wasn't loaded, try it forced relative
strcpy(temppath, "//");
strcat(temppath, basedpath);
- BLI_convertstringcode(temppath, pathname);
+ BLI_path_abs(temppath, pathname);
bfd = load_game_data(temppath);
}
get_filename(argc_py_clamped, argv, filename);
if(filename[0])
- BLI_convertstringcwd(filename);
+ BLI_path_cwd(filename);
do
{
// base the actuator filename relative to the last file
strcpy(basedpath, exitstring.Ptr());
- BLI_convertstringcode(basedpath, pathname);
+ BLI_path_abs(basedpath, pathname);
bfd = load_game_data(basedpath);
strcpy(temppath, "//");
strcat(temppath, basedpath);
- BLI_convertstringcode(temppath, pathname);
+ BLI_path_abs(temppath, pathname);
bfd = load_game_data(temppath);
}
}
return NULL;
BLI_strncpy(expanded, filename, FILE_MAXDIR + FILE_MAXFILE);
- BLI_convertstringcode(expanded, gp_GamePythonPath);
+ BLI_path_abs(expanded, gp_GamePythonPath);
return PyUnicode_FromString(expanded);
}
if (searchpath) {
BLI_strncpy(cpath, searchpath, FILE_MAXDIR + FILE_MAXFILE);
- BLI_convertstringcode(cpath, gp_GamePythonPath);
+ BLI_path_abs(cpath, gp_GamePythonPath);
} else {
/* Get the dir only */
BLI_split_dirfile(gp_GamePythonPath, cpath, NULL);
char expanded[FILE_MAXDIR + FILE_MAXFILE];
BLI_split_dirfile(filename, expanded, NULL); /* get the dir part of filename only */
- BLI_convertstringcode(expanded, gp_GamePythonPath); /* filename from lib->filename is (always?) absolute, so this may not be needed but it wont hurt */
+ BLI_path_abs(expanded, gp_GamePythonPath); /* filename from lib->filename is (always?) absolute, so this may not be needed but it wont hurt */
BLI_cleanup_file(gp_GamePythonPath, expanded); /* Dont use BLI_cleanup_dir because it adds a slash - BREAKS WIN32 ONLY */
item= PyUnicode_FromString(expanded);