@@ -32,25 +32,24 @@ export function getSessions() {
3232 return sessions ;
3333}
3434
35- function createSession ( name ) {
35+ function createSession ( ) {
3636 const id = getNowForFilename ( ) ;
3737 const file = sessions_dir . get_child ( id ) ;
3838 ensureDir ( file ) ;
3939 const session = new Session ( file ) ;
40- session . settings . set_string ( "name" , name ) ;
4140 return session ;
4241}
4342
4443export function createSessionFromDemo ( demo ) {
4544 const { name, panels } = demo ;
4645
47- const session = createSession ( name ) ;
46+ const session = createSession ( ) ;
4847 const demo_dir = demos_dir . get_child ( name ) ;
4948
50- copy_directory ( demo_dir , session ) ;
51- copy_directory ( rust_template_dir , session ) ;
49+ const { file, settings } = session ;
50+ copyDirectory ( demo_dir , file ) ;
51+ copyDirectory ( rust_template_dir , file ) ;
5252
53- const { settings } = session ;
5453 settings . set_string ( "name" , name ) ;
5554 settings . set_boolean ( "show-code" , panels . includes ( "code" ) ) ;
5655 settings . set_boolean ( "show-style" , panels . includes ( "style" ) ) ;
@@ -65,17 +64,16 @@ export function createSessionFromDemo(demo) {
6564}
6665
6766// There is no copy directory function
68- function copy_directory ( source , destination ) {
67+ function copyDirectory ( source , destination ) {
6968 for ( const file_info of source . enumerate_children (
7069 "" ,
7170 Gio . FileQueryInfoFlags . NOFOLLOW_SYMLINKS ,
7271 null ,
7372 ) ) {
7473 if ( file_info . get_file_type ( ) === Gio . FileType . DIRECTORY ) continue ;
75-
7674 const child = source . get_child ( file_info . get_name ( ) ) ;
7775 child . copy (
78- destination . file . get_child ( child . get_basename ( ) ) ,
76+ destination . get_child ( child . get_basename ( ) ) ,
7977 Gio . FileCopyFlags . NONE ,
8078 null ,
8179 null ,
0 commit comments