Phix : string type -> type check failure

new topic     » topic index » view thread      » older message » newer message

Hi Pete

Getting a fully qualified pathname/filename from a file dialogue, and processing to just get the filename

CSV_current = FileDlg(Open, "", "CSV|*.csv") 
 
if length(CSV_current) > 0 then 
	SetText(FramedText03, get_file_name(CSV_current)) 
end if 

Gives

C:\Phix\builtins\pfile.e:49 in function get_file_name() 
type check failure, path is {67,58,92,80,104,105,120,92,80,114,111,103,1.. 
    path[1..18] = {67'C',58':',92'\',80'P',104'h',105'i',120'x',92'\',80'P',114'r',111'o',103'g',114'r',97'a',109'm',115's',92'\',69'E'} 
    path[19..37] = {85'U',87'W',105'i',110'n',71'G',85'U',73'I',92'\',69'E',87'W',71'G',45'-',68'D',101'e',115's',105'i',103'g',110'n',101'e'} 
    path[38..55] = {114'r',92'\',80'P',114'r',111'o',106'j',101'e',99'c',116't',115's',92'\',86'V',101'e',116't',65'A',110'n',97'a',108'l'} 
    path[56..73] = {121'y',115's',101'e',114'r',92'\',65'A',108'l',108'l',87'W',111'o',114'r',107'k',45'-',83'S',101'e',112'p',116't',45'-'} 
    path[74..80] = {78'N',111'o',118'v',46'.',99'c',115's',118'v'} 

in function get_file_name

global function get_file_name(string path) 
    if not finit then initf() end if 
    path = get_proper_path(path) 
    path = path[rfind(SLASH,path)+1..$] 
    return path 
end function 

produces the error

and changing the string to a sequence,

global function get_file_name(sequence path) 
    if not finit then initf() end if 
    path = get_proper_path(path) 
    path = path[rfind(SLASH,path)+1..$] 
    return path 
end function 

functions as expected, no error

Cheers

Chris

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu