Sys.command("mkdir",["C:\\Денис"]);
File.saveContent("C:\\Денис\\test.txt", "Денис");
C:\<garbage>
--
To post to this group haxe...@googlegroups.com
http://groups.google.com/group/haxelang?hl=en
---
You received this message because you are subscribed to the Google Groups "Haxe" group.
For more options, visit https://groups.google.com/d/optout.
untyped __cpp__("system(\"mkdir C:\\Денис")");
C:\ДениÑ
var path = "c:\\Денис";
untyped __global__._wmkdir(path.__WCStr());
How are Haxe strings encoded on the cpp side? You may have to convert the filename's String to UTF16 and use Unicode-capable IO cpp functions.
--
What would one of you do in this situation?
static value file_open( value name, value r ) {
val_check(name,string);
val_check(r,string);
fio *f = new fio(val_filename(name));
#ifdef NEKO_WINDOWS
const wchar_t *fname = val_wstring(name);
const wchar_t *mode = val_wstring(r);
#else
const char *fname = val_string(name);
const char *mode = val_string(r);
#endif
gc_enter_blocking();
#ifdef NEKO_WINDOWS
f->io = _wfopen(fname,mode);
#else
f->io = fopen(fname,mode);
#endif
if( f->io == NULL )
{
file_error("file_open",f,true);
}
gc_exit_blocking();
value result = alloc_abstract(k_file,f);
val_gc(result,free_file);
return result;
}
static value file_contents( value name ) {
buffer s=0;
int len;
int p;
val_check(name,string);
fio f(val_filename(name));
#ifdef NEKO_WINDOWS
const wchar_t *fname = val_wstring(name);
#else
const char *fname = val_string(name);
#endif
gc_enter_blocking();
#ifdef NEKO_WINDOWS
f.io = _wfopen(fname,L"rb");
#else
f.io = fopen(fname,"rb");
#endif
if( f.io == NULL )
file_error("file_contents",&f);
fseek(f.io,0,SEEK_END);
len = ftell(f.io);
fseek(f.io,0,SEEK_SET);
gc_exit_blocking();
s = alloc_buffer_len(len);
p = 0;
gc_enter_blocking();
while( len > 0 ) {
int d;
POSIX_LABEL(file_contents);
d = (int)fread((char*)buffer_data(s)+p,1,len,f.io);
if( d <= 0 ) {
HANDLE_FINTR(f.io,file_contents);
fclose(f.io);
file_error("file_contents",&f);
}
p += d;
len -= d;
}
fclose(f.io);
gc_exit_blocking();
return buffer_val(s);
}